From 7ffb36d28e517a6f3a10272056fc127592ab1c19 Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Fri, 23 Mar 2012 09:17:21 +0100 Subject: [PATCH] scan(): Symbolic names instead of magic numbers. --- h/scansbr.h | 3 +++ uip/scan.c | 6 +++--- uip/scansbr.c | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/h/scansbr.h b/h/scansbr.h index 18a9364..1f0d087 100644 --- a/h/scansbr.h +++ b/h/scansbr.h @@ -21,6 +21,9 @@ extern char *scanl; #define WIDTH 78 +#define SCN_MBOX (-1) +#define SCN_FOLD 0 + /* ** prototypes */ diff --git a/uip/scan.c b/uip/scan.c index 0c17268..92dadf6 100644 --- a/uip/scan.c +++ b/uip/scan.c @@ -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; diff --git a/uip/scansbr.c b/uip/scansbr.c index 4b2add5..eba09f0 100644 --- a/uip/scansbr.c +++ b/uip/scansbr.c @@ -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 */ -- 1.7.10.4