OSSP CVS Repository

ossp - Check-in [776]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 776
Date: 2001-Aug-27 16:49:32 (local)
2001-Aug-27 14:49:32 (UTC)
User:thl
Branch:
Comment: now using NUL instead of '\0'
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/lmtp.c      1.15 -> 1.16     9 inserted, 5 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp.c      1.29 -> 1.30     6 inserted, 2 deleted
ossp-pkg/lmtp2nntp/msg.c      1.11 -> 1.12     13 inserted, 13 deleted
ossp-pkg/lmtp2nntp/nntp.c      1.17 -> 1.18     10 inserted, 6 deleted
ossp-pkg/lmtp2nntp/sa.c      1.4 -> 1.5     5 inserted, 1 deleted

ossp-pkg/lmtp2nntp/lmtp.c 1.15 -> 1.16

--- lmtp.c       2001/08/23 09:12:30     1.15
+++ lmtp.c       2001/08/27 14:49:32     1.16
@@ -43,6 +43,10 @@
 #include "dmalloc.h"
 #endif
 
+#ifndef NUL
+#define NUL '\0'
+#endif
+
 /* maximum LMTP protocol line length */
 #define LMTP_LINE_MAXLEN 1024
 
@@ -120,7 +124,7 @@
 
     lmtp->rl.rl_cnt = 0;
     lmtp->rl.rl_bufptr = NULL;
-    lmtp->rl.rl_buf[0] = '\0';
+    lmtp->rl.rl_buf[0] = NUL;
     lmtp->rfd = rfd;
     lmtp->wfd = wfd;
     
@@ -179,7 +183,7 @@
         buf[n++] = c;       /* output char into given buffer */
 
     }
-    buf[n] = '\0';          /* string termination */
+    buf[n] = NUL;          /* string termination */
     if (n == (buflen-1)) 
         return LMTP_ERR_OVERFLOW;
     return LMTP_OK;
@@ -237,14 +241,14 @@
         }
         else if (rc == LMTP_OK) {
             if (strcmp(cpLine, ".") == 0) {     /* dot alone is end of message */
-                *cpLine = '\0';                 /* hide dot from caller */
+                *cpLine = NUL;                 /* hide dot from caller */
                 break;
             }
             if (*cpLine == '.')                 /* escaped dot */
                 memmove(cpLine, cpLine+1, strlen(cpLine+1)+1);
             cpPtr += strlen(cpPtr);             /* write cursor to the end */
             *cpPtr++ = '\n';                    /* artifical NL */
-            *cpPtr = '\0';                      /* artifical end of string */
+            *cpPtr = NUL;                      /* artifical end of string */
             cpLine = cpPtr;                     /* start of line */
         }
         else break;                             /* rc == LMTP_ERR* */
@@ -286,7 +290,7 @@
                 continue; /* skip  ""  verb */
             if (   (strlen(req->msg) >= verblen)
                 && (strncasecmp(req->msg, verb, verblen) == 0)
-                && (   (req->msg[verblen] == '\0')
+                && (   (req->msg[verblen] == NUL)
                     || (req->msg[verblen] == ' ') )           ) {
                 req->verb = verb;
                 return LMTP_OK;


ossp-pkg/lmtp2nntp/lmtp2nntp.c 1.29 -> 1.30

--- lmtp2nntp.c  2001/08/27 14:29:11     1.29
+++ lmtp2nntp.c  2001/08/27 14:49:32     1.30
@@ -45,6 +45,10 @@
 #define TRUE (!FALSE)
 #endif
 
+#ifndef NUL
+#define NUL '\0'
+#endif
+
 #define ERR_EXECUTION -1
 #define ERR_DELIVERY -2
 
@@ -202,7 +206,7 @@
                         exit(ERR_EXECUTION);
                     }
 
-                    optarg[3] = '\0';
+                    optarg[3] = NUL;
                     ctx->option_deliverymodefakestatus = &optarg[0];
                     ctx->option_deliverymodefakedsn    = &optarg[4];
 
@@ -247,7 +251,7 @@
                 /* parse host[:port] string into host and port */
                 cpHost = strdup(optarg);
                 if ((cpPort = strrchr(cpHost, ':')) != NULL) {
-                    *cpPort++ = '\0';
+                    *cpPort++ = NUL;
                     cpPort = strdup(cpPort);
                 }
                 else 


ossp-pkg/lmtp2nntp/msg.c 1.11 -> 1.12

--- msg.c        2001/08/27 14:29:11     1.11
+++ msg.c        2001/08/27 14:49:32     1.12
@@ -74,19 +74,19 @@
      * msg->cpMsg
      * must contain the wholly RFC0822 formatted message with native
      * (unescaped) dots at the beginning of a line, the 'From ' envelope,
-     * headers, double newline, body, '\0', no trailing dot;
+     * headers, double newline, body, NUL, no trailing dot;
      *
      * OUTPUTS
      *
      * msg->azHeaders, msg->asHeaders contains the headers in argz format, one
-     * logical '\0'-terminated line per header which might be wrapped into
+     * logical NUL-terminated line per header which might be wrapped into
      * multiple '\n'-ended physical lines. The "From " envelope, "Received:",
      * "Path:", "To:" and "Cc:" headers are removed silently. The
      * "Newsgroups:" and "Message-ID" headers are removed and their values are
      * stored in separate structures (see below).
      *
      * msg->cpBody
-     * contains the unmodified body of the message, '\0'-terminated, no
+     * contains the unmodified body of the message, NUL-terminated, no
      * trailing dot.
      *
      * msg->cpMsgid
@@ -228,7 +228,7 @@
     if ((aHeaders = (char **)malloc((argz_count(msg->azHeaders, msg->asHeaders) + 1) * sizeof(char *))) == NULL)
         return MSG_ERR_MEM;
     argz_extract(msg->azHeaders, msg->asHeaders, aHeaders);
-    /* replace the trailing '\0', which is *(cp-1) of the predecessor, with a
+    /* replace the trailing NUL, which is *(cp-1) of the predecessor, with a
      * space at every second string. Break action when terminating NULL string
      * is detected */
     i=0;
@@ -257,7 +257,7 @@
         if (strlen(cp) > WRAPAT) {
             cpRem = cp;
             cpWrap = NULL;
-            for (o = 0; (cpRem[o] != ':') && (cpRem[o] != '\0'); o++); /* offset name so at least one char of value remains in first line */
+            for (o = 0; (cpRem[o] != ':') && (cpRem[o] != NUL); o++); /* offset name so at least one char of value remains in first line */
             o += 2; /* skip ": " */
             while ((strlen(cpRem) + (cpWrap == NULL ? 0 : strlen(WRAPUSING))) > WRAPAT) {
                 for (i = WRAPAT - 1 - (cpWrap == NULL ? 0 : strlen(WRAPUSING)); (i >= o) && !isblank(cpRem[i]); i--);
@@ -265,13 +265,13 @@
                     i = WRAPAT - 1 - (cpWrap == NULL ? 0 : strlen(WRAPUSING) - 1); /* sorry, forced cut at non-blank */
                 cpCut = cpRem;
                 cpRem += i;
-                for (; (isblank(*cpRem) && (*cpRem != '\0')); cpRem++); /* skip next lines leading blanks */
+                for (; (isblank(*cpRem) && (*cpRem != NUL)); cpRem++); /* skip next lines leading blanks */
                 for (; (i >= o) && isblank(cpCut[i-1]); i--); /* chop off this lines trailing blanks */
                 if (i >= o) { /* only keep line fragment if some non-blanks inside */
                     if (cpWrap == NULL) {
                         if ((cpWrap = (char *)malloc(i+strlen(WRAPUSING)+1)) == NULL)
                             return MSG_ERR_MEM;
-                        *cpWrap = '\0';
+                        *cpWrap = NUL;
                         o = 1;
                     }
                     else {
@@ -298,12 +298,12 @@
     cpHeaders = msg->azHeaders;
 
     /********************************************************************
-     * header + CRLF + body + '.' + CRLF + '\0', replacing NL with CRLF *
+     * header + CRLF + body + '.' + CRLF + NUL, replacing NL with CRLF *
      ********************************************************************/
 
     n = 0;
     /* count size of headers, reserve space for NL to CRLF conversion */
-    for (i = 0; ((c = cpHeaders[i]) != '\0'); i++) {
+    for (i = 0; ((c = cpHeaders[i]) != NUL); i++) {
         if (c == '\n')
             n++;
         n++;
@@ -315,7 +315,7 @@
     n+=2;
     /* count size of body, reserve space for NL-DOT escape and NL to CRLF conversion */
     cOld = '\n';
-    for (i = 0; ((c = msg->cpBody[i]) != '\0'); i++) {
+    for (i = 0; ((c = msg->cpBody[i]) != NUL); i++) {
         if (c == '\n')
             n++;
         if (c == '.' && cOld == '\n')
@@ -334,7 +334,7 @@
 
     n = 0;
     /* copy headers, do NL to CRLF conversion */
-    for (i = 0; ((c = cpHeaders[i]) != '\0'); i++) {
+    for (i = 0; ((c = cpHeaders[i]) != NUL); i++) {
         if (c == '\n')
             msg->cpMsg[n++] = '\r';
         msg->cpMsg[n++] = c;
@@ -349,7 +349,7 @@
     msg->cpMsg[n++] = '\n';
     /* copy body, do NL-DOT escape and NL to CRLF conversion */
     cOld = '\n';
-    for (i = 0; ((c = msg->cpBody[i]) != '\0'); i++) {
+    for (i = 0; ((c = msg->cpBody[i]) != NUL); i++) {
         if (c == '\n')
             msg->cpMsg[n++] = '\r';
         if (c == '.' && cOld == '\n')
@@ -366,7 +366,7 @@
     msg->cpMsg[n++] =  '.';
     msg->cpMsg[n++] = '\r';
     msg->cpMsg[n++] = '\n';
-    msg->cpMsg[n]   = '\0';
+    msg->cpMsg[n]   = NUL;
 
     return MSG_OK;
 }


ossp-pkg/lmtp2nntp/nntp.c 1.17 -> 1.18

--- nntp.c       2001/08/27 14:29:11     1.17
+++ nntp.c       2001/08/27 14:49:32     1.18
@@ -53,6 +53,10 @@
 #define TRUE (!FALSE)
 #endif
 
+#ifndef NUL
+#define NUL '\0'
+#endif
+
 /* maximum NNTP protocol line length */
 #define NNTP_LINE_MAXLEN 1024
 
@@ -92,7 +96,7 @@
     nntp->wfd = wfd;
     nntp->rl.rl_cnt = 0;
     nntp->rl.rl_bufptr = NULL;
-    nntp->rl.rl_buf[0] = '\0';
+    nntp->rl.rl_buf[0] = NUL;
     nntp_timeout(nntp, 3);
     nntp->kludgeinn441dup = FALSE;
 
@@ -204,7 +208,7 @@
         buf[n++] = c;       /* output char into given buffer */
 
     }
-    buf[n] = '\0';          /* string termination */
+    buf[n] = NUL;          /* string termination */
     if (n == (buflen-1)) 
         return NNTP_ERR_OVERFLOW;
     return NNTP_OK;
@@ -254,7 +258,7 @@
      *  
      *  In other words, INN *requires* the use of "MODE READER".
      */
-    *line = '\0';
+    *line = NUL;
     strcat(line, "MODE READER");
     if ((rc = nntp_writeline(nntp, line)) != NNTP_OK)
         return rc;
@@ -278,7 +282,7 @@
      *  < 223 yes, article already known
      *  < 430 no, i don't know the article, yet
      */
-    *line = '\0';
+    *line = NUL;
     strcat(line, "STAT ");
     strcat(line, msg->cpMsgid);
     if ((rc = nntp_writeline(nntp, line)) != NNTP_OK)
@@ -318,7 +322,7 @@
      *  
      *  In other words, INN uses 441 for other status messages as well.
      */
-    *line = '\0';
+    *line = NUL;
     strcat(line, "POST");
     if ((rc = nntp_writeline(nntp, line)) != NNTP_OK)
         return rc;
@@ -381,7 +385,7 @@
      *  < 437 Unwanted newsgroup "quux"
      *  < 480 Transfer permission denied
      */
-    *line = '\0';
+    *line = NUL;
     strcat(line, "IHAVE ");
     strcat(line, msg->cpMsgid);
     if ((rc = nntp_writeline(nntp, line)) != NNTP_OK)


ossp-pkg/lmtp2nntp/sa.c 1.4 -> 1.5

--- sa.c 2001/08/23 09:12:30     1.4
+++ sa.c 2001/08/27 14:49:32     1.5
@@ -76,6 +76,10 @@
 #endif
 #endif
 
+#ifndef NUL
+#define NUL '\0'
+#endif
+
 sa_t *sa_create(int sa_type, ...)
 {
     va_list ap;
@@ -133,7 +137,7 @@
 
         /* resolve port */
         bNumeric = 1;
-        for (i = 0; cpPort[i] != '\0'; i++) {
+        for (i = 0; cpPort[i] != NUL; i++) {
             if (!isdigit(cpPort[i])) {
                 bNumeric = 0;
                 break;

CVSTrac 2.0.1