]> diplodocus.org Git - nmh/commitdiff
Merge branch 'master' of git.sv.gnu.org:/srv/git/nmh
authorKen Hornstein <kenh@pobox.com>
Wed, 1 Nov 2017 00:48:40 +0000 (20:48 -0400)
committerKen Hornstein <kenh@pobox.com>
Wed, 1 Nov 2017 00:48:40 +0000 (20:48 -0400)
23 files changed:
sbr/addrsbr.c
sbr/dtimep.l
sbr/encode_rfc2047.c
sbr/fmt_addr.c
sbr/fmt_compile.c
sbr/fmt_scan.c
sbr/netsec.c
sbr/print_sw.c
uip/burst.c
uip/comp.c
uip/dist.c
uip/fmttest.c
uip/folder.c
uip/forw.c
uip/imaptest.c
uip/inc.c
uip/install-mh.c
uip/mark.c
uip/mhbuild.c
uip/mhbuildsbr.c
uip/mhlist.c
uip/mhlsbr.c
uip/mhn.c

index eadf1d0..e55c15a 100644 (file)
@@ -270,7 +270,7 @@ auxformat (struct mailname *mp, int extras)
 bool
 ismymbox (struct mailname *np)
 {
-    int oops;
+    bool oops;
     int len, i;
     char *cp;
     char *pp;
@@ -278,7 +278,7 @@ ismymbox (struct mailname *np)
     struct mailname *mp;
     static char *am = NULL;
     static struct mailname mq;
-    static int localmailbox = 0;
+    static bool localmailbox;
 
     /*
      * If this is the first call, initialize
@@ -290,7 +290,7 @@ ismymbox (struct mailname *np)
 
        if ((am = context_find ("local-mailbox"))) {
 
-           localmailbox++;
+           localmailbox = true;
 
            if ((cp = getname(am)) == NULL) {
                inform("Unable to find address in local-mailbox, continuing...");
@@ -312,11 +312,11 @@ ismymbox (struct mailname *np)
            am = getusername();
        else {
            mp = mq.m_next ? mq.m_next : &mq;
-           oops = 0;
+           oops = false;
            while ((cp = getname (am))) {
                if ((mp->m_next = getm (cp, NULL, 0, NULL, 0)) == NULL) {
                    inform("illegal address: %s, continuing...", cp);
-                   oops++;
+                   oops = true;
                } else {
                    mp = mp->m_next;
                    mp->m_type = W_NIL;
index bd36c64..fdae74c 100644 (file)
@@ -156,10 +156,6 @@ static int day_map[] = {
                        --cp; }
 #define SKIPTOA()    { while ( !isalpha((unsigned char) *cp++) ) ; \
                        --cp; }
-#define SKIPSP()     { while ( isspace((unsigned char) *cp++) ) ; \
-                       --cp; }
-#define SKIPTOSP()   { while ( !isspace((unsigned char) *cp++) ) ; \
-                       --cp; }
 
 # ifdef HAVE_SYS_TIME_H
 #  include <sys/time.h>
index e7ccd30..be74c67 100644 (file)
@@ -552,7 +552,11 @@ field_encode_address(const char *name, char **value, int encoding,
                     const char *charset)
 {
     int prefixlen = strlen(name) + 2, column = prefixlen, groupflag;
-    int asciichars, specialchars, eightbitchars, reformat = 0, errflag = 0;
+    int asciichars;
+    int specialchars;
+    int eightbitchars;
+    bool reformat = false;
+    bool errflag = false;
     size_t len;
     char *mp, *cp = NULL, *output = NULL;
     char *tmpbuf = NULL;
@@ -577,11 +581,11 @@ field_encode_address(const char *name, char **value, int encoding,
     for (groupflag = 0; (mp = getname(*value)); ) {
        if ((mn = getm(mp, NULL, 0, errbuf, sizeof(errbuf))) == NULL) {
            inform("%s: %s", errbuf, mp);
-           errflag++;
+           errflag = true;
            continue;
        }
 
-       reformat = 0;
+       reformat = false;
 
        /*
         * We only care if the phrase (m_pers) or any trailing comment
@@ -620,7 +624,7 @@ field_encode_address(const char *name, char **value, int encoding,
 
            case CE_BASE64:
                if (field_encode_base64(NULL, &mn->m_pers, charset)) {
-                   errflag++;
+                   errflag = true;
                    goto out;
                }
                break;
@@ -628,18 +632,18 @@ field_encode_address(const char *name, char **value, int encoding,
            case CE_QUOTED:
                if (field_encode_quoted(NULL, &mn->m_pers, charset, asciichars,
                                        eightbitchars + specialchars, 1)) {
-                   errflag++;
+                   errflag = true;
                    goto out;
                }
                break;
 
            default:
                inform("Internal error: unknown RFC-2047 encoding type");
-               errflag++;
+               errflag = true;
                goto out;
            }
 
-           reformat++;
+           reformat = true;
        }
 
        check_note:
@@ -662,7 +666,7 @@ field_encode_address(const char *name, char **value, int encoding,
        if (mn->m_note[0] != '(' || mn->m_note[len - 1] != ')') {
            inform("Internal error: Invalid note field \"%s\"",
                   mn->m_note);
-           errflag++;
+           errflag = true;
            goto out;
        }
 
@@ -683,7 +687,7 @@ field_encode_address(const char *name, char **value, int encoding,
 
            case CE_BASE64:
                if (field_encode_base64(NULL, &tmpbuf, charset)) {
-                   errflag++;
+                   errflag = true;
                    goto out;
                }
                break;
@@ -691,18 +695,18 @@ field_encode_address(const char *name, char **value, int encoding,
            case CE_QUOTED:
                if (field_encode_quoted(NULL, &tmpbuf, charset, asciichars,
                                        eightbitchars + specialchars, 1)) {
-                   errflag++;
+                   errflag = true;
                    goto out;
                }
                break;
 
            default:
                inform("Internal error: unknown RFC-2047 encoding type");
-               errflag++;
+               errflag = true;
                goto out;
            }
 
-           reformat++;
+           reformat = true;
 
            /*
             * Make sure the size of tmpbuf is correct (it always gets
@@ -803,7 +807,7 @@ out:
     free(tmpbuf);
     free(output);
 
-    return errflag > 0;
+    return errflag;
 }
 
 /*
index 2c7b58e..4684fa7 100644 (file)
@@ -50,7 +50,7 @@ char *
 formataddr (char *orig, char *str)
 {
     int len;
-    int isgroup;
+    bool isgroup;
     char *dst;
     char *cp;
     char *sp;
@@ -79,13 +79,13 @@ formataddr (char *orig, char *str)
     }
 
     /* concatenate all the new addresses onto 'buf' */
-    for (isgroup = 0; (cp = getname (str)); ) {
+    for (isgroup = false; (cp = getname (str)); ) {
        if ((mp = getm (cp, NULL, 0, NULL, 0)) == NULL)
            continue;
 
        if (isgroup && (mp->m_gname || !mp->m_ingrp)) {
            *dst++ = ';';
-           isgroup = 0;
+           isgroup = false;
        }
        /* if we get here we're going to add an address */
        if (dst != buf) {
@@ -95,7 +95,7 @@ formataddr (char *orig, char *str)
        if (mp->m_gname) {
            CHECKMEM (mp->m_gname);
            CPY (mp->m_gname);
-           isgroup++;
+           isgroup = true;
        }
        sp = adrformat (mp);
        CHECKMEM (sp);
index ce32414..216b8e7 100644 (file)
@@ -488,13 +488,13 @@ do_spec(char *sp)
 {
     char *cp = sp;
     int c;
-    int ljust = 0;
+    bool ljust = false;
     int wid = 0;
     char fill = ' ';
 
     c = *cp++;
     if (c == '-') {
-       ljust++;
+       ljust = true;
        c = *cp++;
     }
     if (c == '0') {
@@ -543,7 +543,7 @@ do_name(char *sp, int preprocess)
     char *cp = sp;
     int c;
     int i;
-    static int primed = 0;
+    static bool primed;
 
     while (isalnum(c = *cp++) || c == '-' || c == '_')
        ;
@@ -573,7 +573,7 @@ do_name(char *sp, int preprocess)
     case FT_GETMYADDR:
        if (!primed) {
            ismymbox(NULL);
-           primed++;
+           primed = true;
        }
        /* FALLTHRU */
     case FT_PARSEADDR:
@@ -1044,13 +1044,15 @@ fmt_addcompentry(char *component)
 int
 fmt_addcomptext(char *component, char *text)
 {
-    int i, found = 0, bucket = CHASH(component);
+    int i;
+    bool found = false;
+    int bucket = CHASH(component);
     struct comp *cptr = wantcomp[bucket];
     char *cp;
 
     while (cptr) {
        if (strcasecmp(component, FENDNULL(cptr->c_name)) == 0) {
-           found++;
+           found = true;
            if (! cptr->c_text) {
                cptr->c_text = getcpy(text);
            } else {
index 2e54728..3c93a5a 100644 (file)
@@ -122,7 +122,7 @@ cpnumber(charstring_t dest, int num, int wid, char fill, size_t max) {
 void
 cptrimmed(charstring_t dest, char *str, int wid, char fill, size_t max) {
     int remaining;     /* remaining output width available */
-    int rjust;
+    bool rjust;
     struct charstring *trimmed;
     size_t end;        /* number of input bytes remaining in str */
 #ifdef MULTIBYTE_SUPPORT
@@ -134,10 +134,10 @@ cptrimmed(charstring_t dest, char *str, int wid, char fill, size_t max) {
     char *sp;          /* current position in source string */
 
     /* get alignment */
-    rjust = 0;
+    rjust = false;
     if ((remaining = wid) < 0) {
        remaining = -remaining;
-       rjust++;
+       rjust = true;
     }
     if (remaining > (int) max) { remaining = max; }
 
@@ -396,7 +396,8 @@ fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat,
     char *sp;
     char *savestr, *str;
     char buffer[NMH_BUFSIZ], buffer2[NMH_BUFSIZ];
-    int i, c, rjust;
+    int i, c;
+    bool rjust;
     int value;
     time_t t;
     size_t max;
@@ -464,11 +465,11 @@ fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat,
            break;
        case FT_LITF:
            sp = fmt->f_text;
-           rjust = 0;
+           rjust = false;
            i = fmt->f_width;
            if (i < 0) {
                i = -i;
-               rjust++;                /* XXX should do something with this */
+               rjust = true;           /* XXX should do something with this */
            }
            while ((c = *sp++) && --i >= 0 && charstring_chars (scanlp) < max) {
                charstring_push_back (scanlp, c);
@@ -723,10 +724,10 @@ fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat,
                    str = buffer;
                    while (isspace((unsigned char) *str))
                            str++;
-                   rjust = 0;
+                   rjust = false;
                    if ((i = fmt->f_width) < 0) {
                            i = -i;
-                           rjust++;
+                           rjust = true;
                    }
 
                    if (!rjust && i > 0 && (int) strlen(str) > i)
index ab49046..1fe8f1a 100644 (file)
@@ -30,7 +30,7 @@ static int netsec_get_user(void *context, int id, const char **result,
 static int netsec_get_password(sasl_conn_t *conn, void *context, int id,
                               sasl_secret_t **psecret);
 
-static int sasl_initialized = 0;
+static bool sasl_initialized;
 
 #define SASL_MAXRECVBUF 65536
 #endif /* CYRUS_SASL */
@@ -39,7 +39,7 @@ static int sasl_initialized = 0;
 #include <openssl/ssl.h>
 #include <openssl/err.h>
 
-static int tls_initialized = 0;
+static bool tls_initialized;
 static SSL_CTX *sslctx = NULL;         /* SSL Context */
 
 #endif /* TLS_SUPPORT */
@@ -1032,7 +1032,7 @@ netsec_set_sasl_params(netsec_context *nsc, const char *service,
                       sasl_errstring(retval, NULL, NULL));
            return NOTOK;
        }
-       sasl_initialized++;
+       sasl_initialized = true;
     }
 
     /*
@@ -1550,7 +1550,7 @@ netsec_set_tls(netsec_context *nsc, int tls, int noverify, char **errstr)
                return NOTOK;
            }
 
-           tls_initialized++;
+           tls_initialized = true;
        }
 
        if (nsc->ns_readfd == -1 || nsc->ns_writefd == -1) {
index ad92b88..cf5cda7 100644 (file)
@@ -11,7 +11,8 @@
 void
 print_sw (const char *substr, const struct swit *swp, char *prefix, FILE *fp)
 {
-    int len, optno;
+    int len;
+    bool optno;
     int i;
     char *cp, *cp1, *sp;
     char buf[128];
@@ -20,14 +21,14 @@ print_sw (const char *substr, const struct swit *swp, char *prefix, FILE *fp)
     for (; swp->sw; swp++) {
        /* null matches all strings */
        if (!*substr || (ssequal (substr, swp->sw) && len >= swp->minchars)) {
-           optno = 0;
+           optno = false;
            /* next switch */
            if ((sp = (&swp[1])->sw)) {
                if (!*substr && sp[0] == 'n' && sp[1] == 'o' &&
                        strcmp (&sp[2], swp->sw) == 0 && (
                        ((&swp[1])->minchars == 0 && swp->minchars == 0) ||
                        ((&swp[1])->minchars == (swp->minchars) + 2)))
-                   optno++;
+                   optno = true;
            }
 
            if (swp->minchars > 0) {
index dd1970c..82822c6 100644 (file)
@@ -50,7 +50,7 @@ int debugsw = 0;
  */
 static int find_delim (int, struct smsg *, int *);
 static void find_mime_parts (CT, struct smsg *, int *);
-static void burst (struct msgs **, int, struct smsg *, int, int, int,
+static void burst(struct msgs **, int, struct smsg *, int, bool, bool,
                   char *, int);
 static void cpybrst (FILE *, FILE *, char *, char *, int, int);
 
@@ -68,7 +68,10 @@ static void cpybrst (FILE *, FILE *, char *, char *, int, int);
 int
 main (int argc, char **argv)
 {
-    int inplace = 0, quietsw = 0, verbosw = 0, mimesw = 1;
+    bool inplace = false;
+    bool quietsw = false;
+    bool verbosw = false;
+    int mimesw = 1;
     int hi, msgnum, numburst;
     char *cp, *maildir, *folder = NULL, buf[BUFSIZ];
     char **argp, **arguments;
@@ -100,10 +103,10 @@ main (int argc, char **argv)
                done (0);
 
            case INPLSW: 
-               inplace++;
+               inplace = true;
                continue;
            case NINPLSW: 
-               inplace = 0;
+               inplace = false;
                continue;
 
            case MIMESW:
@@ -117,17 +120,17 @@ main (int argc, char **argv)
                continue;
 
            case QIETSW: 
-               quietsw++;
+               quietsw = true;
                continue;
            case NQIETSW: 
-               quietsw = 0;
+               quietsw = false;
                continue;
 
            case VERBSW: 
-               verbosw++;
+               verbosw = true;
                continue;
            case NVERBSW: 
-               verbosw = 0;
+               verbosw = false;
                continue;
            }
        }
@@ -362,7 +365,7 @@ find_mime_parts (CT content, struct smsg *smsgs, int *msgp)
 
 static void
 burst (struct msgs **mpp, int msgnum, struct smsg *smsgs, int numburst,
-       int inplace, int verbosw, char *maildir, int mimesw)
+    bool inplace, bool verbosw, char *maildir, int mimesw)
 {
     int i, j, mode;
     char *msgnam;
index 1aba280..fb1051e 100644 (file)
@@ -70,7 +70,10 @@ static struct swit aqrul[] = {
 int
 main (int argc, char **argv)
 {
-    int use = NOUSE, nedit = 0, nwhat = 0, build = 0;
+    int use = NOUSE;
+    bool nedit = false;
+    bool nwhat = false;
+    bool build = false;
     int i, in = NOTOK, isdf = 0, out, dat[5], format_len = 0;
     int outputlinelen = OUTPUTLINELEN;
     char *cp, *cwd, *maildir, *dfolder = NULL;
@@ -109,23 +112,23 @@ main (int argc, char **argv)
                case EDITRSW: 
                    if (!(ed = *argp++) || *ed == '-')
                        die("missing argument to %s", argp[-2]);
-                   nedit = 0;
+                   nedit = false;
                    continue;
                case NEDITSW: 
-                   nedit++;
+                   nedit = true;
                    continue;
 
                case WHATSW: 
                    if (!(whatnowproc = *argp++) || *whatnowproc == '-')
                        die("missing argument to %s", argp[-2]);
-                   nwhat = 0;
+                   nwhat = false;
                    continue;
 
                case BILDSW:
-                   build++;
+                   build = true;
                    /* FALLTHRU */
                case NWHATSW: 
-                   nwhat++;
+                   nwhat = true;
                    continue;
 
                case FORMSW: 
index 4fb33bf..d42cfef 100644 (file)
@@ -71,10 +71,14 @@ static struct swit aqrl[] = {
 int
 main (int argc, char **argv)
 {
-    int anot = 0, inplace = 1, nedit = 0;
-    int nwhat = 0, i, in, isdf = 0, out;
+    bool anot = false;
+    bool inplace = true;
+    bool nedit = false;
+    bool nwhat = false;
+    int i, in, isdf = 0, out;
     int outputlinelen = OUTPUTLINELEN;
-    int dat[5], atfile = 0;
+    int dat[5];
+    bool atfile = false;
     char *cp, *cwd, *maildir, *msgnam, *dfolder = NULL;
     char *dmsg = NULL, *ed = NULL, *file = NULL, *folder = NULL;
     char *form = NULL, *msg = NULL, buf[BUFSIZ], drft[BUFSIZ];
@@ -107,28 +111,28 @@ main (int argc, char **argv)
                    done (0);
 
                case ANNOSW: 
-                   anot++;
+                   anot = true;
                    continue;
                case NANNOSW: 
-                   anot = 0;
+                   anot = false;
                    continue;
 
                case EDITRSW: 
                    if (!(ed = *argp++) || *ed == '-')
                        die("missing argument to %s", argp[-2]);
-                   nedit = 0;
+                   nedit = false;
                    continue;
                case NEDITSW:
-                   nedit++;
+                   nedit = true;
                    continue;
                    
                case WHATSW: 
                    if (!(whatnowproc = *argp++) || *whatnowproc == '-')
                        die("missing argument to %s", argp[-2]);
-                   nwhat = 0;
+                   nwhat = false;
                    continue;
                case NWHATSW: 
-                   nwhat++;
+                   nwhat = true;
                    continue;
 
                case FILESW: 
@@ -144,10 +148,10 @@ main (int argc, char **argv)
                    continue;
 
                case INPLSW: 
-                   inplace++;
+                   inplace = true;
                    continue;
                case NINPLSW: 
-                   inplace = 0;
+                   inplace = false;
                    continue;
 
                case DFOLDSW: 
@@ -198,10 +202,10 @@ main (int argc, char **argv)
                    continue;
 
                case ATFILESW:
-                   atfile++;
+                   atfile = true;
                    continue;
                case NOATFILESW:
-                   atfile = 0;
+                   atfile = false;
                    continue;
            }
        }
@@ -259,7 +263,7 @@ try_it_again:
        /*
         * Dist a file
         */
-       anot = 0;       /* don't want to annotate a file */
+       anot = false;   /* don't want to annotate a file */
     } else {
        /*
         * Dist a message
index 446d5b0..568b559 100644 (file)
@@ -103,7 +103,7 @@ static int insert(struct mailname *);
 static void mlistfree(void);
 
 static bool nodupcheck;        /* If set, no check for duplicates */
-static int ccme = 0;           /* Should I cc myself? */
+static bool ccme;              /* Should I cc myself? */
 static struct mailname mq;     /* Mail addresses to check for duplicates */
 static char *dummy = "dummy";
 
@@ -116,8 +116,12 @@ main (int argc, char **argv)
     struct format *fmt;
     struct comp *cptr;
     struct msgs_array msgs = { 0, 0, NULL }, compargs = { 0, 0, NULL};
-    int dump = 0, i;
-    int outputsize = 0, dupaddrs = 1, trace = 0, files = 0;
+    bool dump = false;
+    int i;
+    int outputsize = 0;
+    bool dupaddrs = true;
+    bool trace = false;
+    int files = 0;
     int colwidth = -1, msgnum = -1, msgcur = -1, msgsize = -1, msgunseen = -1;
     enum mode_t mode = MESSAGE;
     int dat[5];
@@ -185,10 +189,10 @@ main (int argc, char **argv)
                    continue;
 
                case TRACESW:
-                   trace++;
+                   trace = true;
                    continue;
                case NTRACESW:
-                   trace = 0;
+                   trace = false;
                    continue;
 
                case ADDRSW:
@@ -201,7 +205,7 @@ main (int argc, char **argv)
                case MESSAGESW:
                    mode = MESSAGE;
                    defformat = FORMAT;
-                   dupaddrs = 0;
+                   dupaddrs = false;
                    continue;
                case DATESW:
                    mode = DATE;
@@ -216,17 +220,17 @@ main (int argc, char **argv)
                    continue;
 
                case DUPADDRSW:
-                   dupaddrs++;
+                   dupaddrs = true;
                    continue;
                case NDUPADDRSW:
-                   dupaddrs = 0;
+                   dupaddrs = false;
                    continue;
 
                case CCMESW:
-                   ccme++;
+                   ccme = true;
                    continue;
                case NCCMESW:
-                   ccme = 0;
+                   ccme = false;
                    continue;
 
                case WIDTHSW:
@@ -256,10 +260,10 @@ main (int argc, char **argv)
                    continue;
 
                case DUMPSW:
-                   dump++;
+                   dump = true;
                    continue;
                case NDUMPSW:
-                   dump = 0;
+                   dump = false;
                    continue;
 
            }
@@ -336,11 +340,11 @@ main (int argc, char **argv)
      * callback, do that now.  Also, prime ismymbox if we use it.
      */
 
-    if (dupaddrs == 0 || trace) {
+    if (!dupaddrs || trace) {
        ZERO(&cb);
        cbp = &cb;
 
-       if (dupaddrs == 0) {
+       if (!dupaddrs) {
            cb.formataddr = test_formataddr;
            cb.concataddr = test_concataddr;
            if (!ccme)
@@ -721,19 +725,20 @@ test_trace(void *context, struct format *fmt, int num, char *str,
           const char *outbuf)
 {
     struct trace_context *ctx = (struct trace_context *) context;
-    int changed = 0;
+    bool changed = false;
 
     dumpone(fmt);
 
     if (num != ctx->num) {
        printf("num=%d", num);
        ctx->num = num;
-       changed++;
+       changed = true;
     }
 
     if (str != ctx->str) {
-       if (changed++)
+       if (changed)
             putchar(' ');
+        changed = true;
        fputs("str=", stdout);
        litputs(str);
        ctx->str = str;
@@ -1210,7 +1215,7 @@ test_formataddr (char *orig, char *str)
 {
     int len;
     char error[BUFSIZ];
-    int isgroup;
+    bool isgroup;
     char *dst;
     char *cp;
     char *sp;
@@ -1239,14 +1244,14 @@ test_formataddr (char *orig, char *str)
     }
 
     /* concatenate all the new addresses onto 'buf' */
-    for (isgroup = 0; (cp = getname (str)); ) {
+    for (isgroup = false; (cp = getname (str)); ) {
        if ((mp = getm (cp, NULL, 0, error, sizeof(error))) == NULL) {
            fprintf(stderr, "bad address \"%s\" -- %s\n", cp, error);
            continue;
        }
        if (isgroup && (mp->m_gname || !mp->m_ingrp)) {
            *dst++ = ';';
-           isgroup = 0;
+           isgroup = false;
        }
        if (insert (mp)) {
            /* if we get here we're going to add an address */
@@ -1257,7 +1262,7 @@ test_formataddr (char *orig, char *str)
            if (mp->m_gname) {
                CHECKMEM (mp->m_gname);
                CPY (mp->m_gname);
-               isgroup++;
+               isgroup = true;
            }
            sp = adrformat (mp);
            CHECKMEM (sp);
index 2141f32..97a1fdc 100644 (file)
@@ -47,12 +47,12 @@ DEFINE_SWITCH_ENUM(FOLDER);
 DEFINE_SWITCH_ARRAY(FOLDER, switches);
 #undef X
 
-static int fshort   = 0;       /* output only folder names                 */
+static bool fshort;            /* output only folder names                 */
 static int fcreat   = 0;       /* should we ask to create new folders?     */
-static int fpack    = 0;       /* are we packing the folder?               */
-static int fverb    = 0;       /* print actions taken while packing folder */
+static bool fpack;             /* are we packing the folder?               */
+static bool fverb;             /* print actions taken while packing folder */
 static int fheader  = 0;       /* should we output a header?               */
-static int frecurse = 0;       /* recurse through subfolders               */
+static bool frecurse;          /* recurse through subfolders               */
 static int ftotal   = 0;       /* should we output the totals?             */
 static bool all;               /* should we output all folders             */
 
@@ -159,10 +159,10 @@ main (int argc, char **argv)
                    continue;
 
                case FASTSW: 
-                   fshort++;
+                   fshort = true;
                    continue;
                case NFASTSW: 
-                   fshort = 0;
+                   fshort = false;
                    continue;
 
                case HDRSW: 
@@ -173,24 +173,24 @@ main (int argc, char **argv)
                    continue;
 
                case PACKSW: 
-                   fpack++;
+                   fpack = true;
                    continue;
                case NPACKSW: 
-                   fpack = 0;
+                   fpack = false;
                    continue;
 
                case VERBSW:
-                   fverb++;
+                   fverb = true;
                    continue;
                case NVERBSW:
-                   fverb = 0;
+                   fverb = false;
                    continue;
 
                case RECURSW: 
-                   frecurse++;
+                   frecurse = true;
                    continue;
                case NRECRSW: 
-                   frecurse = 0;
+                   frecurse = false;
                    continue;
 
                case TOTALSW: 
index 3d52696..6e9f3bd 100644 (file)
@@ -102,9 +102,13 @@ static void copy_mime_draft (int);
 int
 main (int argc, char **argv)
 {
-    int anot = 0, inplace = 1, mime = 0;
+    bool anot = false;
+    bool inplace = true;
+    bool mime = false;
     int issue = 0, volume = 0, dashstuff = 0;
-    int nedit = 0, nwhat = 0, i, in;
+    bool nedit = false;
+    bool nwhat = false;
+    int i, in;
     int out, isdf = 0, msgnum = 0;
     int outputlinelen = OUTPUTLINELEN;
     int dat[5];
@@ -116,7 +120,7 @@ main (int argc, char **argv)
     char **argp, **arguments;
     struct stat st;
     struct msgs_array msgs = { 0, 0, NULL };
-    int buildsw = 0;
+    bool buildsw = false;
 
     if (nmh_init(argv[0], true, true)) { return 1; }
 
@@ -142,31 +146,31 @@ main (int argc, char **argv)
                    done (0);
 
                case ANNOSW: 
-                   anot++;
+                   anot = true;
                    continue;
                case NANNOSW: 
-                   anot = 0;
+                   anot = false;
                    continue;
 
                case EDITRSW: 
                    if (!(ed = *argp++) || *ed == '-')
                        die("missing argument to %s", argp[-2]);
-                   nedit = 0;
+                   nedit = false;
                    continue;
                case NEDITSW:
-                   nedit++;
+                   nedit = true;
                    continue;
 
                case WHATSW: 
                    if (!(whatnowproc = *argp++) || *whatnowproc == '-')
                        die("missing argument to %s", argp[-2]);
-                   nwhat = 0;
+                   nwhat = false;
                    continue;
                case BILDSW:
-                   buildsw++;
+                   buildsw = true;
                    /* FALLTHRU */
                case NWHATSW: 
-                   nwhat++;
+                   nwhat = true;
                    continue;
 
                case FILESW: 
@@ -180,7 +184,7 @@ main (int argc, char **argv)
                    if (!(cp = *argp++) || *cp == '-')
                        die("missing argument to %s", argp[-2]);
                    filter = mh_xstrdup(etcpath(cp));
-                   mime = 0;
+                   mime = false;
                    continue;
                case FORMSW: 
                    if (!(form = *argp++) || *form == '-')
@@ -195,25 +199,25 @@ main (int argc, char **argv)
                    continue;
 
                case INPLSW: 
-                   inplace++;
+                   inplace = true;
                    continue;
                case NINPLSW: 
-                   inplace = 0;
+                   inplace = false;
                    continue;
 
                case MIMESW:
-                   mime++;
+                   mime = true;
                    filter = NULL;
                    continue;
                case NMIMESW: 
-                   mime = 0;
+                   mime = false;
                    continue;
 
                case DGSTSW: 
                    if (!(cp = *argp++) || *cp == '-')
                        die("missing argument to %s", argp[-2]);
                    digest = mh_xstrdup(cp);
-                   mime = 0;
+                   mime = false;
                    continue;
                case ISSUESW:
                    if (!(cp = *argp++) || *cp == '-')
@@ -342,7 +346,7 @@ try_it_again:
        /*
         * Forwarding a file.
          */
-       anot = 0;       /* don't want to annotate a file */
+       anot = false;   /* don't want to annotate a file */
     } else {
        /*
         * Forwarding a message.
index 09ee3de..01d3ee5 100644 (file)
@@ -704,7 +704,7 @@ get_imap_response(netsec_context *nsc, const char *token, char **tokenresponse,
 {
     char *line;
     struct imap_cmd *cmd;
-    int numerrs = 0;
+    bool numerrs = false;
 
     if (tokenresponse)
        *tokenresponse = NULL;
@@ -735,7 +735,7 @@ getline:
                        cmd->next = cmd->next->next;
                        if (failerr && strncmp(line + strlen(cmd2->tag),
                                                        "OK ", 3) != 0) {
-                           numerrs++;
+                           numerrs = true;
                            netsec_err(errstr, "%s", line + strlen(cmd2->tag));
                        }
                        free(cmd2);
@@ -751,7 +751,7 @@ getline:
        }
     }
 
-    return numerrs == 0 ? OK : NOTOK;
+    return numerrs ? NOTOK : OK;
 }
 
 /*
index d65c46f..44d6193 100644 (file)
--- a/uip/inc.c
+++ b/uip/inc.c
@@ -99,7 +99,7 @@ static struct Maildir_entry {
        time_t mtime;
 } *Maildir = NULL;
 static int num_maildir_entries = 0;
-static int snoop = 0;
+static bool snoop;
 
 typedef struct {
     FILE *mailout;
@@ -329,7 +329,7 @@ main (int argc, char **argv)
                continue;
 
            case SNOOPSW:
-               snoop++;
+               snoop = true;
                continue;
        
            case SASLSW:
index c3fc4f7..f059296 100644 (file)
@@ -31,7 +31,7 @@ DEFINE_SWITCH_ARRAY(INSTALLMH, switches);
 int
 main (int argc, char **argv)
 {
-    int autof = 0;
+    bool autof = false;
     char *cp, buf[BUFSIZ];
     const char *pathname;
     char *dp, **arguments, **argp;
@@ -66,7 +66,7 @@ main (int argc, char **argv)
                    done (0);
 
                case AUTOSW:
-                   autof++;
+                   autof = true;
                    continue;
 
                case CHECKSW:
index 8c02825..3941e93 100644 (file)
@@ -43,8 +43,13 @@ static void seq_printdebug (struct msgs *);
 int
 main (int argc, char **argv)
 {
-    int addsw = 0, deletesw = 0, debugsw = 0;
-    int listsw = 0, publicsw = -1, zerosw = 0, msgnum;
+    bool addsw = false;
+    bool deletesw = false;
+    bool debugsw = false;
+    bool listsw = false;
+    int publicsw = -1;
+    bool zerosw = false;
+    int msgnum;
     unsigned int seqp = 0;
     char *cp, *maildir, *folder = NULL, buf[BUFSIZ];
     char **argp, **arguments;
@@ -79,16 +84,19 @@ main (int argc, char **argv)
                done (0);
 
            case ADDSW: 
-               addsw++;
-               deletesw = listsw = 0;
+               addsw = true;
+               deletesw = false;
+                listsw = false;
                continue;
            case DELSW: 
-               deletesw++;
-               addsw = listsw = 0;
+               deletesw = true;
+               addsw = false;
+                listsw = false;
                continue;
            case LSTSW: 
-               listsw++;
-               addsw = deletesw = 0;
+               listsw = true;
+               addsw = false;
+                deletesw = false;
                continue;
 
            case SEQSW: 
@@ -107,14 +115,14 @@ main (int argc, char **argv)
                continue;
 
            case DEBUGSW: 
-               debugsw++;
+               debugsw = true;
                continue;
 
            case ZEROSW: 
-               zerosw++;
+               zerosw = true;
                continue;
            case NZEROSW: 
-               zerosw = 0;
+               zerosw = false;
                continue;
            }
        }
@@ -133,9 +141,9 @@ main (int argc, char **argv)
      */
     if (!addsw && !deletesw && !listsw) {
        if (seqp)
-           addsw++;
+           addsw = true;
        else
-           listsw++;
+           listsw = true;
     }
 
     if (!context_find ("path"))
index 233d7a6..d9ad442 100644 (file)
@@ -75,9 +75,9 @@ DEFINE_SWITCH_ARRAY(MIMEENCODING, encodingswitches);
 
 int debugsw = 0;
 
-int listsw   = 0;
-int rfc934sw = 0;
-int contentidsw = 1;
+bool listsw;
+bool rfc934sw;
+bool contentidsw = true;
 
 /*
  * Temporary files
@@ -89,11 +89,12 @@ static char outfile[BUFSIZ];
 int
 main (int argc, char **argv)
 {
-    int sizesw = 1, headsw = 1;
+    bool sizesw = true;
+    bool headsw = true;
     bool directives = true;
     bool autobuild = false;
     bool dist = false;
-    int verbosw = 0;
+    bool verbosw = false;
     bool dispo = false;
     size_t maxunencoded = MAXTEXTPERLN;
     int *icachesw;
@@ -116,8 +117,8 @@ main (int argc, char **argv)
            if (compfile)
                die("cannot specify both standard input and a file");
             compfile = cp;
-           listsw = 0;         /* turn off -list if using standard in/out */
-           verbosw = 0;        /* turn off -verbose listings */
+           listsw = false;     /* turn off -list if using standard in/out */
+           verbosw = false;    /* turn off -verbose listings */
            break;
        }
        if (*cp == '-') {
@@ -177,10 +178,10 @@ main (int argc, char **argv)
                continue;
 
            case HEADSW:
-               headsw++;
+               headsw = true;
                continue;
            case NHEADSW:
-               headsw = 0;
+               headsw = false;
                continue;
 
            case DIRECTIVES:
@@ -191,31 +192,31 @@ main (int argc, char **argv)
                continue;
 
            case LISTSW:
-               listsw++;
+               listsw = true;
                continue;
            case NLISTSW:
-               listsw = 0;
+               listsw = false;
                continue;
 
            case RFC934SW:
-               rfc934sw++;
+               rfc934sw = true;
                continue;
            case NRFC934SW:
-               rfc934sw = 0;
+               rfc934sw = false;
                continue;
 
            case SIZESW:
-               sizesw++;
+               sizesw = true;
                continue;
            case NSIZESW:
-               sizesw = 0;
+               sizesw = false;
                continue;
 
            case CONTENTIDSW:
-               contentidsw = 1;
+               contentidsw = true;
                continue;
            case NCONTENTIDSW:
-               contentidsw = 0;
+               contentidsw = false;
                continue;
 
            case HEADERENCSW: {
@@ -258,10 +259,10 @@ main (int argc, char **argv)
                continue;
 
            case VERBSW: 
-               verbosw++;
+               verbosw = true;
                continue;
            case NVERBSW: 
-               verbosw = 0;
+               verbosw = false;
                continue;
            case DISPOSW:
                dispo = true;
index fc41dd1..b8b28f2 100644 (file)
@@ -39,9 +39,9 @@
 
 extern int debugsw;
 
-extern int listsw;
-extern int rfc934sw;
-extern int contentidsw;
+extern bool listsw;
+extern bool rfc934sw;
+extern bool contentidsw;
 
 static char prefix[] = "----- =_aaaaaaaaaa";
 
index 1a1ccf9..dd9b6d0 100644 (file)
@@ -71,7 +71,7 @@ main (int argc, char **argv)
 {
     bool sizesw = true;
     bool headsw = true;
-    int chgflag = 1;
+    bool chgflag = true;
     bool verbosw = false;
     bool dispo = false;
     int msgnum, *icachesw;
@@ -191,10 +191,10 @@ do_cache:
                continue;
 
            case CHGSW:
-               chgflag++;
+               chgflag = true;
                continue;
            case NCHGSW:
-               chgflag = 0;
+               chgflag = false;
                continue;
 
            case VERBSW: 
index 6253994..ef9f830 100644 (file)
@@ -261,8 +261,8 @@ static int bellflg   = 0;
 static int clearflg  = 0;
 static int dashstuff = 0;
 static bool dobody = true;
-static int forwflg   = 0;
-static int forwall   = 0;
+static bool forwflg;
+static bool forwall;
 
 static int sleepsw = NOTOK;
 
@@ -271,7 +271,7 @@ static int volume = 0;
 static int issue = 0;
 
 static int exitstat = 0;
-static int mhldebug = 0;
+static bool mhldebug;
 
 static int filesize = 0;
 
@@ -338,7 +338,8 @@ static void compile_filterargs (void);
 int
 mhl (int argc, char **argv)
 {
-    int length = 0, nomore = 0;
+    int length = 0;
+    bool nomore = false;
     unsigned int i, vecp = 0;
     int width = 0;
     char *cp, *folder = NULL, *form = NULL;
@@ -352,7 +353,7 @@ mhl (int argc, char **argv)
     argp = arguments;
 
     if ((cp = getenv ("MHLDEBUG")) && *cp)
-       mhldebug++;
+       mhldebug = true;
 
     while ((cp = *argp++)) {
        if (*cp == '-') {
@@ -405,7 +406,7 @@ mhl (int argc, char **argv)
                        mhladios (NULL, "missing argument to %s", argp[-2]);
                    continue;
                case NPROGSW:
-                   nomore++;
+                   nomore = true;
                    continue;
 
                case FMTPROCSW:
@@ -447,10 +448,10 @@ mhl (int argc, char **argv)
                    continue;
 
                case FORW2SW: 
-                   forwall++;
+                   forwall = true;
                    /* FALLTHRU */
                case FORW1SW: 
-                   forwflg++;
+                   forwflg = true;
                    clearflg = -1;/* XXX */
                    continue;
 
@@ -1267,7 +1268,8 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag)
 {
     char *text; /* c1's text, or the name as a fallback. */
     char *trimmed_prefix;
-    int count, cchdr;
+    int count;
+    bool cchdr;
     char *cp;
     const int utf8 = strcasecmp(get_charset(), "UTF-8") == 0;
 
@@ -1282,7 +1284,7 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag)
      * blank lines. */
     trimmed_prefix = rtrim(mh_xstrdup(FENDNULL(text)));
 
-    cchdr = 0;
+    cchdr = false;
     lm = 0;
     llim = c1->c_length ? c1->c_length : -1;
     wid = c1->c_width ? c1->c_width : global.c_width;
@@ -1325,7 +1327,7 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag)
            if (!(c1->c_flags & SPLIT))
                c1->c_flags |= HDROUTPUT;
 
-       cchdr++;
+       cchdr = true;
        if ((count = c1->c_cwidth - strlen(text) - 2) > 0)
            while (count--)
                putstr (" ", c1->c_flags);
@@ -1344,7 +1346,7 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag)
        if (!(c1->c_flags & SPLIT))
            c2->c_flags |= HDROUTPUT;
 
-       cchdr++;
+       cchdr = true;
        if ((count = c1->c_cwidth - strlen (c2->c_name) - 2) > 0)
            while (count--)
                putstr (" ", c1->c_flags);
@@ -1397,7 +1399,7 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag)
 static char *
 oneline (char *stuff, unsigned long flags)
 {
-    int spc;
+    bool spc;
     char *cp, *ret;
 
     if (onelp == NULL)
@@ -1408,7 +1410,7 @@ oneline (char *stuff, unsigned long flags)
     ret = onelp;
     term = 0;
     if (flags & COMPRESS) {
-       for (spc = 1, cp = ret; *onelp; onelp++)
+       for (spc = true, cp = ret; *onelp; onelp++)
            if (isspace ((unsigned char) *onelp)) {
                if (*onelp == '\n' && (!onelp[1] || (flags & ADDRFMT))) {
                    term = '\n';
@@ -1417,12 +1419,12 @@ oneline (char *stuff, unsigned long flags)
                }
                 if (!spc) {
                     *cp++ = ' ';
-                    spc++;
+                    spc = true;
                 }
            }
            else {
                *cp++ = *onelp;
-               spc = 0;
+               spc = false;
            }
 
        *cp = 0;
index 0d1d48e..9e50688 100644 (file)
--- a/uip/mhn.c
+++ b/uip/mhn.c
@@ -89,7 +89,7 @@ static int rfc934sw = 0;
 /*
  * what action to take?
  */
-static int cachesw = 0;
+static bool cachesw;
 static bool listsw;
 static bool showsw;
 static bool storesw;
@@ -107,7 +107,7 @@ main (int argc, char **argv)
 {
     bool sizesw = true;
     bool headsw = true;
-    int autosw = 0;
+    bool autosw = false;
     int msgnum, *icachesw;
     char *cp, *file = NULL, *folder = NULL;
     char *maildir, buf[100], **argp;
@@ -148,17 +148,17 @@ main (int argc, char **argv)
                done (0);
 
            case AUTOSW:
-               autosw++;
+               autosw = true;
                continue;
            case NAUTOSW:
-               autosw = 0;
+               autosw = false;
                continue;
 
            case CACHESW:
-               cachesw++;
+               cachesw = true;
                continue;
            case NCACHESW:
-               cachesw = 0;
+               cachesw = false;
                continue;
 
            case RCACHESW: