]> diplodocus.org Git - nmh/commitdiff
h/mts.h: Replace char pointer mmdlm1 with macro MMDF_DELIM.
authorRalph Corderoy <ralph@inputplus.co.uk>
Sun, 28 May 2017 12:07:25 +0000 (13:07 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sun, 28 May 2017 12:07:25 +0000 (13:07 +0100)
mmdlm1 only ever pointed to its initial string constant.

h/mh.h
h/mts.h
sbr/m_getfld.c
sbr/mts.c
uip/dropsbr.c

diff --git a/h/mh.h b/h/mh.h
index 30c6dfdc55b5370a48ac8e77b4a5f5f285354535..6b7dec613a75a0c9984654c767482d3169fdc064 100644 (file)
--- a/h/mh.h
+++ b/h/mh.h
@@ -382,7 +382,7 @@ typedef struct m_getfld_state *m_getfld_state_t;
 #define        MS_DEFAULT      0       /* default (one msg per file) */
 #define        MS_UNKNOWN      1       /* type not known yet         */
 #define        MS_MBOX         2       /* Unix-style "from" lines    */
-#define        MS_MMDF         3       /* string mmdlm1              */
+#define        MS_MMDF         3       /* string MMDF_DELIM          */
 
 #define        NOUSE   0               /* draft being re-used */
 
diff --git a/h/mts.h b/h/mts.h
index 585c058d6c0230c0348415563bca92b26cdff731..d0fa4f05c575567681b8117832d8319f4f1caad7 100644 (file)
--- a/h/mts.h
+++ b/h/mts.h
@@ -26,7 +26,7 @@ char *getlocalmbox(void);
 /*
  * Separators
  */
-extern char *mmdlm1;
+#define MMDF_DELIM "\001\001\001\001\n"
 
 /*
  * Read mts.conf file
index ef36a6e52cf36206a44a008526470980c70fcdd0..e82a2fff789baf5721acd785b4a874f1cfa58c65 100644 (file)
@@ -806,7 +806,7 @@ m_unknown(m_getfld_state_t *gstate, FILE *iob)
        /* not a Unix style maildrop */
        s->readpos -= s->bytes_read;
        s->bytes_read = 0;
-       delimstr = mmdlm1;
+       delimstr = MMDF_DELIM;
        s->msg_style = MS_MMDF;
     }
 
index 65059201d417ae0fea8040f94ae59cc2e331bf12..ae617cec9d45273a3351fcf23218fd316f6fb098 100644 (file)
--- a/sbr/mts.c
+++ b/sbr/mts.c
@@ -46,8 +46,6 @@ char *mmdflfil = "";
 char *uucpldir = "/usr/spool/mail";
 char *uucplfil = "";
 
-char *mmdlm1 = "\001\001\001\001\n";
-
 char *spoollocking = DEFAULT_LOCKING;
 
 /* Cache the username, fullname, and mailbox of the user */
index d54696be92488b4f9d1bbe9b3848defda38912dc..8f841a1e7c0bc484484d1b1aebc496717098d0d9 100644 (file)
@@ -133,7 +133,7 @@ mbx_chk_mmdf (int fd)
     ssize_t count;
     char ldelim[BUFSIZ];
 
-    count = strlen (mmdlm1);
+    count = LEN(MMDF_DELIM);
 
     if (lseek (fd, -count, SEEK_END) == (off_t) NOTOK)
        return NOTOK;
@@ -142,9 +142,9 @@ mbx_chk_mmdf (int fd)
 
     ldelim[count] = 0;
 
-    if (strcmp (ldelim, mmdlm1)
+    if (strcmp (ldelim, MMDF_DELIM)
            && write (fd, "\n", 1) != 1
-           && write (fd, mmdlm1, count) != count)
+           && write (fd, MMDF_DELIM, count) != count)
        return NOTOK;
 
     return OK;
@@ -168,8 +168,8 @@ mbx_copy (char *mailbox, int mbx_style, int md, int fd,
     switch (mbx_style) {
        case MMDF_FORMAT: 
        default: 
-           j = strlen (mmdlm1);
-           if (write (md, mmdlm1, j) != j)
+           j = LEN(MMDF_DELIM);
+           if (write (md, MMDF_DELIM, j) != j)
                return NOTOK;
 
            if (text) {
@@ -184,16 +184,16 @@ mbx_copy (char *mailbox, int mbx_style, int md, int fd,
            while ((i = read (fd, buffer, sizeof buffer - 1)) > 0) {
                 buffer[i] = '\0';   /* Terminate for stringdex(). */
 
-               for ( ; (j = stringdex (mmdlm1, buffer)) >= 0; buffer[j]++)
+               for ( ; (j = stringdex (MMDF_DELIM, buffer)) >= 0; buffer[j]++)
                    continue;
-               for ( ; (j = stringdex (mmdlm1, buffer)) >= 0; buffer[j]++)
+               for ( ; (j = stringdex (MMDF_DELIM, buffer)) >= 0; buffer[j]++)
                    continue;
                if (write (md, buffer, i) != i)
                    return NOTOK;
            }
 
-           j = strlen (mmdlm1);
-           if (write (md, mmdlm1, j) != j)
+           j = LEN(MMDF_DELIM);
+           if (write (md, MMDF_DELIM, j) != j)
                return NOTOK;
 
            return (i != NOTOK ? OK : NOTOK);