From: Ralph Corderoy Date: Sun, 28 May 2017 12:07:25 +0000 (+0100) Subject: h/mts.h: Replace char pointer mmdlm1 with macro MMDF_DELIM. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/8beec5a149ff31d48971f869d99c7c99926ca790?ds=sidebyside;hp=d0bd505e1a9b0bc2fc107446dcb615bf55c42e81 h/mts.h: Replace char pointer mmdlm1 with macro MMDF_DELIM. mmdlm1 only ever pointed to its initial string constant. --- diff --git a/h/mh.h b/h/mh.h index 30c6dfdc..6b7dec61 100644 --- 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 585c058d..d0fa4f05 100644 --- 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 diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index ef36a6e5..e82a2fff 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -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; } diff --git a/sbr/mts.c b/sbr/mts.c index 65059201..ae617cec 100644 --- 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 */ diff --git a/uip/dropsbr.c b/uip/dropsbr.c index d54696be..8f841a1e 100644 --- a/uip/dropsbr.c +++ b/uip/dropsbr.c @@ -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);