scan(): Symbolic names instead of magic numbers.
authormarkus schnalke <meillo@marmaro.de>
Fri, 23 Mar 2012 08:17:21 +0000 (09:17 +0100)
committermarkus schnalke <meillo@marmaro.de>
Fri, 23 Mar 2012 08:17:21 +0000 (09:17 +0100)
h/scansbr.h
uip/scan.c
uip/scansbr.c

index 18a9364..1f0d087 100644 (file)
@@ -21,6 +21,9 @@ extern char *scanl;
 
 #define WIDTH  78
 
+#define SCN_MBOX (-1)
+#define SCN_FOLD 0
+
 /*
 ** prototypes
 */
index 0c17268..92dadf6 100644 (file)
@@ -127,7 +127,7 @@ main(int argc, char **argv)
 
                m_unknown(in);
                for (msgnum = 1; ; ++msgnum) {
-                       state = scan(in, msgnum, -1, fmtstr, width, 0, 0);
+                       state = scan(in, msgnum, SCN_MBOX, fmtstr, width, 0, 0);
                        if (state != SCNMSG)
                                break;
                }
@@ -205,8 +205,8 @@ main(int argc, char **argv)
                                }
                        }
 
-                       switch (state = scan(in, msgnum, 0, fmtstr, width,
-                                       msgnum == mp->curmsg, unseen)) {
+                       switch (state = scan(in, msgnum, SCN_FOLD, fmtstr,
+                                       width, msgnum==mp->curmsg, unseen)) {
                        case SCNMSG:
                        case SCNERR:
                                break;
index 4b2add5..eba09f0 100644 (file)
@@ -76,8 +76,8 @@ scan(FILE *inb, int innum, int outnum, char *fmtstr, int width, int curflg,
        char name[NAMESZ];
        char returnpath[BUFSIZ];
        char deliverydate[BUFSIZ];
-       int incing = (outnum > 0);
-       int scanfolder = (outnum == 0);
+       int incing = (outnum != SCN_MBOX && outnum != SCN_FOLD);
+       int scanfolder = (outnum == SCN_FOLD);
        long fpos;
 
        /* first-time only initialization */