]> diplodocus.org Git - nmh/blobdiff - uip/slocal.c
Makefile.am: Alter long lists to be sorted, one entry per line.
[nmh] / uip / slocal.c
index 55e2f7fc87c278e24d2ccb85133af52cce2ddd98..1e044f5208369a4ecf2eb9d21f1edd84cf5a20ce 100644 (file)
@@ -1,6 +1,4 @@
-
-/*
- * slocal.c -- asynchronously filter and deliver new mail
+/* slocal.c -- asynchronously filter and deliver new mail
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -452,7 +450,7 @@ usr_delivery (int fd, char *delivery, int su)
        if (*buffer == '#' || *buffer == '\n')
            continue;
 
-        TrimSuffixC(buffer, '\n');
+        trim_suffix_c(buffer, '\n');
 
        /* split buffer into fields */
        vecp = split (buffer, vec);
@@ -484,7 +482,8 @@ usr_delivery (int fd, char *delivery, int su)
                 * do this - else fall through
                 */
                if (!next)
-                   continue;   /* else fall */
+                   continue;
+               /* FALLTHRU */
 
            case '?': 
                /*
@@ -492,7 +491,8 @@ usr_delivery (int fd, char *delivery, int su)
                 * consider delivered if action is successful.
                 */
                if (won)
-                   continue;   /* else fall */
+                   continue;
+               /* FALLTHRU */
 
            case 'A': 
            case 'a': 
@@ -538,7 +538,8 @@ usr_delivery (int fd, char *delivery, int su)
                    if (won)
                        continue;
                    break;
-               }               /* else fall */
+               }
+               /* FALLTHRU */
 
            default: 
                /* parse message and build lookup table */
@@ -565,7 +566,8 @@ usr_delivery (int fd, char *delivery, int su)
            case 'q':
                /* deliver to quoted pipe */
                if (strcasecmp (action, "qpipe"))
-                   continue;   /* else fall */
+                   continue;
+               /* FALLTHRU */
            case '^':
                expand (tmpbuf, string, fd);
                if (split (tmpbuf, vec) < 1)
@@ -576,7 +578,8 @@ usr_delivery (int fd, char *delivery, int su)
            case 'p': 
                /* deliver to pipe */
                if (strcasecmp (action, "pipe"))
-                   continue;   /* else fall */
+                   continue;
+               /* FALLTHRU */
            case '|': 
                vec[2] = "sh";
                vec[3] = "-c";
@@ -594,7 +597,8 @@ usr_delivery (int fd, char *delivery, int su)
                }
                /* deliver to nmh folder */
                else if (strcasecmp (action, "folder"))
-                   continue;   /* else fall */
+                   continue;
+               /* FALLTHRU */
            case '+':
                status = usr_folder (fd, string);
                break;
@@ -607,7 +611,8 @@ usr_delivery (int fd, char *delivery, int su)
                }
                /* mbox format */
                else if (strcasecmp (action, "mbox"))
-                   continue;   /* else fall */
+                   continue;
+               /* FALLTHRU */
 
            case '>': 
                /* mbox format */
@@ -703,7 +708,7 @@ parse (int fd)
     int i, state;
     int fd1;
     char *cp, *dp, *lp;
-    char name[NAMESZ], field[BUFSIZ];
+    char name[NAMESZ], field[NMH_BUFSIZ];
     struct pair *p, *q;
     FILE  *in;
     m_getfld_state_t gstate = 0;
@@ -735,7 +740,7 @@ parse (int fd)
        switch (state = m_getfld (&gstate, name, field, &fieldsz, in)) {
            case FLD: 
            case FLDPLUS: 
-               lp = add (field, NULL);
+               lp = mh_xstrdup(field);
                while (state == FLDPLUS) {
                    fieldsz = sizeof field;
                    state = m_getfld (&gstate, name, field, &fieldsz, in);
@@ -775,11 +780,11 @@ parse (int fd)
 
            case LENERR: 
            case FMTERR: 
-               advise (NULL, "format error in message");
+               inform("format error in message");
                break;
 
            default: 
-               advise (NULL, "internal error in m_getfld");
+               inform("internal error in m_getfld");
                fclose (in);
                return -1;
        }
@@ -1253,7 +1258,7 @@ you_lose:
     while (fgets (buffer, sizeof(buffer), qfp)) {
        if (first) {
            first = 0;
-           if (HasPrefix(buffer, "From ")) {
+           if (has_prefix(buffer, "From ")) {
                /* get copy of envelope information ("From " line) */
                envelope = mh_xstrdup(buffer);
 
@@ -1337,7 +1342,7 @@ verbose_printf (char *fmt, ...)
     va_list ap;
 
     va_start(ap, fmt);
-    vfprintf (stdout, fmt, ap);
+    vprintf(fmt, ap);
     va_end(ap);
 
     fflush (stdout);   /* now flush output */
@@ -1357,22 +1362,22 @@ adorn (char *what, char *fmt, ...)
     char *s;
 
     eindex = errno;    /* save the errno */
-    fprintf (stdout, ", ");
+    printf(", ");
 
     va_start(ap, fmt);
-    vfprintf (stdout, fmt, ap);
+    vprintf(fmt, ap);
     va_end(ap);
 
     if (what) {
        if (*what)
-           fprintf (stdout, " %s: ", what);
+           printf(" %s: ", what);
        if ((s = strerror (eindex)))
-           fprintf (stdout, "%s", s);
+           fputs(s, stdout);
        else
-           fprintf (stdout, "Error %d", eindex);
+           printf("Error %d", eindex);
     }
 
-    fputc ('\n', stdout);
+    putchar('\n');
     fflush (stdout);
 }
 
@@ -1402,7 +1407,7 @@ static int
 suppress_duplicates (int fd, char *file)
 {
     int        fd1, lockfd, state, result;
-    char *cp, buf[BUFSIZ], name[NAMESZ];
+    char *cp, buf[NMH_BUFSIZ], name[NAMESZ];
     datum key, value;
     DBM *db;
     FILE *in;
@@ -1432,7 +1437,7 @@ suppress_duplicates (int fd, char *file)
                    continue;
                }
 
-               cp = add (buf, NULL);
+               cp = mh_xstrdup(buf);
                while (state == FLDPLUS) {
                    bufsz = sizeof buf;
                    state = m_getfld (&gstate, name, buf, &bufsz, in);