]> diplodocus.org Git - nmh/blobdiff - uip/mhlsbr.c
Use existing macros min() and max() more.
[nmh] / uip / mhlsbr.c
index 329ad79e4ab31d7b986440225220cfe4c612f728..6dd1850db14a08ee3e862bec4f2c138d9ed325c9 100644 (file)
@@ -1,6 +1,4 @@
-
-/*
- * mhlsbr.c -- main routines for nmh message lister
+/* mhlsbr.c -- main routines for nmh message lister
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -22,7 +20,7 @@
  * set, then addresses get split wrong (not at the spaces between commas).
  * To fix this correctly, putstr() should know about "atomic" strings that
  * must NOT be broken across lines.  That's too difficult for right now
  * set, then addresses get split wrong (not at the spaces between commas).
  * To fix this correctly, putstr() should know about "atomic" strings that
  * must NOT be broken across lines.  That's too difficult for right now
- * (it turns out that there are a number of degernate cases), so in
+ * (it turns out that there are a number of degenerate cases), so in
  * oneline(), instead of
  *
  *       (*onelp == '\n' && !onelp[1])
  * oneline(), instead of
  *
  *       (*onelp == '\n' && !onelp[1])
@@ -361,16 +359,20 @@ mhl (int argc, char **argv)
                case AMBIGSW: 
                    ambigsw (cp, mhlswitches);
                    mhldone (1);
                case AMBIGSW: 
                    ambigsw (cp, mhlswitches);
                    mhldone (1);
+                   /* FALLTHRU */
                case UNKWNSW: 
                    mhladios (NULL, "-%s unknown\n", cp);
                case UNKWNSW: 
                    mhladios (NULL, "-%s unknown\n", cp);
+                   /* FALLTHRU */
 
                case HELPSW: 
                    snprintf (buf, sizeof(buf), "%s [switches] [files ...]", invo_name);
                    print_help (buf, mhlswitches, 1);
                    mhldone (0);
 
                case HELPSW: 
                    snprintf (buf, sizeof(buf), "%s [switches] [files ...]", invo_name);
                    print_help (buf, mhlswitches, 1);
                    mhldone (0);
+                   /* FALLTHRU */
                case VERSIONSW:
                    print_version(invo_name);
                    mhldone (0);
                case VERSIONSW:
                    print_version(invo_name);
                    mhldone (0);
+                   /* FALLTHRU */
 
                case BELLSW: 
                    bellflg = 1;
 
                case BELLSW: 
                    bellflg = 1;
@@ -449,17 +451,18 @@ mhl (int argc, char **argv)
                    continue;
 
                case FORW2SW: 
                    continue;
 
                case FORW2SW: 
-                   forwall++;  /* fall */
+                   forwall++;
+                   /* FALLTHRU */
                case FORW1SW: 
                    forwflg++;
                    clearflg = -1;/* XXX */
                    continue;
 
                case BITSTUFFSW: 
                case FORW1SW: 
                    forwflg++;
                    clearflg = -1;/* XXX */
                    continue;
 
                case BITSTUFFSW: 
-                   dashstuff = 1;      /* trinary logic */
+                   dashstuff = 1;      /* ternary logic */
                    continue;
                case NBITSTUFFSW: 
                    continue;
                case NBITSTUFFSW: 
-                   dashstuff = -1;     /* trinary logic */
+                   dashstuff = -1;     /* ternary logic */
                    continue;
 
                case NBODYSW: 
                    continue;
 
                case NBODYSW: 
@@ -766,7 +769,7 @@ evalvar (struct mcomp *c1)
            return 1;
 
        if (! c1->c_name  ||  strcasecmp (c1->c_name, "body")) {
            return 1;
 
        if (! c1->c_name  ||  strcasecmp (c1->c_name, "body")) {
-           advise (NULL, "format filters are currently only supported on "
+           inform("format filters are currently only supported on "
                    "the \"body\" component");
            return 1;
        }
                    "the \"body\" component");
            return 1;
        }
@@ -797,7 +800,7 @@ ptoi (char *name, int *i)
     char *cp;
 
     if (*parptr++ != '=' || !*(cp = parse ())) {
     char *cp;
 
     if (*parptr++ != '=' || !*(cp = parse ())) {
-       advise (NULL, "missing argument to variable %s", name);
+       inform("missing argument to variable %s", name);
        return 1;
     }
 
        return 1;
     }
 
@@ -812,7 +815,7 @@ ptos (char *name, char **s)
     char c, *cp;
 
     if (*parptr++ != '=') {
     char c, *cp;
 
     if (*parptr++ != '=') {
-       advise (NULL, "missing argument to variable %s", name);
+       inform("missing argument to variable %s", name);
        return 1;
     }
 
        return 1;
     }
 
@@ -845,15 +848,14 @@ parse (void)
 
     for (cp = result; *parptr && (cp - result < NAMESZ); parptr++) {
        c = *parptr;
 
     for (cp = result; *parptr && (cp - result < NAMESZ); parptr++) {
        c = *parptr;
-       if (isalnum (c)
-               || c == '.'
-               || c == '-'
-               || c == '_'
-               || c =='['
-               || c == ']')
-           *cp++ = c;
-       else
+       if (!isalnum (c)
+               && c != '.'
+               && c != '-'
+               && c != '_'
+               && c !='['
+               && c != ']')
            break;
            break;
+        *cp++ = c;
     }
     *cp = '\0';
 
     }
     *cp = '\0';
 
@@ -900,7 +902,7 @@ process (char *folder, char *fname, int ofilen, int ofilec)
            cp = folder ? concat (folder, ":", fname2, NULL) : mh_xstrdup(fname2);
            if (ontty != PITTY)
                SIGNAL (SIGINT, intrser);
            cp = folder ? concat (folder, ":", fname2, NULL) : mh_xstrdup(fname2);
            if (ontty != PITTY)
                SIGNAL (SIGINT, intrser);
-           mhlfile (fp, cp, ofilen, ofilec);  /* FALL THROUGH! */
+           mhlfile (fp, cp, ofilen, ofilec);
             free (cp);
 
            for (ap = arglist_head; ap; ap = ap->a_next) {
             free (cp);
 
            for (ap = arglist_head; ap; ap = ap->a_next) {
@@ -909,7 +911,8 @@ process (char *folder, char *fname, int ofilen, int ofilec)
            }
 
            if (arglist_head)
            }
 
            if (arglist_head)
-               fmt_free(NULL, 1);
+               fmt_free(NULL, 1);
+           /* FALLTHRU */
 
        default:
            if (ontty != PITTY)
 
        default:
            if (ontty != PITTY)
@@ -932,7 +935,7 @@ mhlfile (FILE *fp, char *mname, int ofilen, int ofilec)
 {
     int state, bucket;
     struct mcomp *c1, *c2, *c3;
 {
     int state, bucket;
     struct mcomp *c1, *c2, *c3;
-    char **ip, name[NAMESZ], buf[BUFSIZ];
+    char **ip, name[NAMESZ], buf[NMH_BUFSIZ];
     m_getfld_state_t gstate = 0;
 
     compile_filterargs();
     m_getfld_state_t gstate = 0;
 
     compile_filterargs();
@@ -1094,7 +1097,7 @@ mhlfile (FILE *fp, char *mname, int ofilen, int ofilec)
 
            case LENERR: 
            case FMTERR: 
 
            case LENERR: 
            case FMTERR: 
-               advise (NULL, "format error in message %s", mname);
+               inform("format error in message %s", mname);
                exitstat++;
                m_getfld_state_destroy (&gstate);
                return;
                exitstat++;
                m_getfld_state_destroy (&gstate);
                return;
@@ -1427,11 +1430,10 @@ oneline (char *stuff, unsigned long flags)
                    *onelp++ = 0;
                    break;
                }
                    *onelp++ = 0;
                    break;
                }
-               else
-                   if (!spc) {
-                       *cp++ = ' ';
-                       spc++;
-                   }
+                if (!spc) {
+                    *cp++ = ' ';
+                    spc++;
+                }
            }
            else {
                *cp++ = *onelp;
            }
            else {
                *cp++ = *onelp;