Replaced msg_style with the boolean ismbox.
authormarkus schnalke <meillo@marmaro.de>
Sat, 24 Mar 2012 16:06:15 +0000 (17:06 +0100)
committermarkus schnalke <meillo@marmaro.de>
Sat, 24 Mar 2012 16:06:15 +0000 (17:06 +0100)
We only need to differ between mbox and MH-default (one msg per file).

h/mh.h
sbr/m_getfld.c

diff --git a/h/mh.h b/h/mh.h
index 0738f42..6a5cf9f 100644 (file)
--- a/h/mh.h
+++ b/h/mh.h
@@ -230,13 +230,7 @@ struct msgs {
 #define BODYEOF  4         /* Body  returned ending at eom     */
 #define FILEEOF  5         /* Reached end of input file        */
 
 #define BODYEOF  4         /* Body  returned ending at eom     */
 #define FILEEOF  5         /* Reached end of input file        */
 
-/*
-** Maildrop styles
-*/
-#define MS_DEFAULT  0    /* default (one msg per file) */
-#define MS_MBOX     1    /* Unix-style "from" lines    */
-
-extern int msg_count;        /* m_getfld() indicators */
+extern int msg_count;        /* m_getfld() indicators (That's a hack!) */
 
 #define NOUSE    0        /* draft being re-used */
 
 
 #define NOUSE    0        /* draft being re-used */
 
index 5dd6973..cefedec 100644 (file)
@@ -144,7 +144,7 @@ static int m_Eom(int, FILE *);
 static unsigned char *matchc(int, char *, int, char *);
 static unsigned char *locc(int, unsigned char *, unsigned char);
 
 static unsigned char *matchc(int, char *, int, char *);
 static unsigned char *locc(int, unsigned char *, unsigned char);
 
-#define eom(c,iob)  (msg_style == MS_MBOX && \
+#define eom(c,iob)  (ismbox && \
        (((c) == *msg_delim && m_Eom(c,iob)) ||\
        (eom_action && (*eom_action)(c))))
 
        (((c) == *msg_delim && m_Eom(c,iob)) ||\
        (eom_action && (*eom_action)(c))))
 
@@ -157,7 +157,7 @@ static unsigned char **pat_map;
 */
 int msg_count = 0;
 
 */
 int msg_count = 0;
 
-int msg_style = MS_DEFAULT;
+int ismbox = FALSE;
 
 /*
 ** The "full" delimiter string for a packed maildrop consists
 
 /*
 ** The "full" delimiter string for a packed maildrop consists
@@ -505,7 +505,7 @@ m_getfld(int state, unsigned char *name, unsigned char *buf,
                cnt = ++iob->_cnt;
 #endif
                c = (cnt < i ? cnt : i);
                cnt = ++iob->_cnt;
 #endif
                c = (cnt < i ? cnt : i);
-               if (msg_style == MS_MBOX && c > 1) {
+               if (ismbox && c > 1) {
                        /*
                        ** packed maildrop - only take up to the (possible)
                        ** start of the next message.  This "matchc" should
                        /*
                        ** packed maildrop - only take up to the (possible)
                        ** start of the next message.  This "matchc" should
@@ -642,7 +642,7 @@ m_unknown(FILE *iob)
        if (strncmp(text, "From ", 5)!=0) {
                adios(NULL, "No Unix style (mbox) maildrop.");
        }
        if (strncmp(text, "From ", 5)!=0) {
                adios(NULL, "No Unix style (mbox) maildrop.");
        }
-       msg_style = MS_MBOX;
+       ismbox = TRUE;
        delimstr = "\nFrom ";
        cp = unixbuf;
        while ((c = getc(iob)) != '\n' && cp - unixbuf < BUFSIZ - 1)
        delimstr = "\nFrom ";
        cp = unixbuf;
        while ((c = getc(iob)) != '\n' && cp - unixbuf < BUFSIZ - 1)
@@ -689,7 +689,7 @@ m_Eom(int c, FILE *iob)
        pos = ftell(iob);
        if ((i = fread(text, sizeof *text, edelimlen, iob)) != edelimlen
                || (strncmp(text, (char *)edelim, edelimlen)!=0)) {
        pos = ftell(iob);
        if ((i = fread(text, sizeof *text, edelimlen, iob)) != edelimlen
                || (strncmp(text, (char *)edelim, edelimlen)!=0)) {
-               if (i == 0 && msg_style == MS_MBOX)
+               if (i == 0 && ismbox)
                        /*
                        ** the final newline in the (brain damaged) unix-format
                        ** maildrop is part of the delimitter - delete it.
                        /*
                        ** the final newline in the (brain damaged) unix-format
                        ** maildrop is part of the delimitter - delete it.
@@ -701,7 +701,7 @@ m_Eom(int c, FILE *iob)
                return 0;
        }
 
                return 0;
        }
 
-       if (msg_style == MS_MBOX) {
+       if (ismbox) {
                cp = unixbuf;
                while ((c = getc(iob)) != '\n' && c >= 0 && cp - unixbuf < BUFSIZ - 1)
                        *cp++ = c;
                cp = unixbuf;
                while ((c = getc(iob)) != '\n' && c >= 0 && cp - unixbuf < BUFSIZ - 1)
                        *cp++ = c;