]> diplodocus.org Git - nmh/blobdiff - uip/whom.c
Add more NORETURN and CHECK_PRINTF function attributes.
[nmh] / uip / whom.c
index 2a36025aeb6846425a9e4036390c1e120bfc298c..c1ef6592e4095ee845f189d198f677f17bb4b0d8 100644 (file)
@@ -1,6 +1,4 @@
-
-/*
- * whom.c -- report to whom a message would be sent
+/* whom.c -- report to whom a message would be sent
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -8,7 +6,10 @@
  */
 
 #include <h/mh.h>
+#include <h/utils.h>
 #include <h/signals.h>
+#include "../sbr/m_maildir.h"
+#include "../sbr/m_mktemp.h"
 
 #ifndef CYRUS_SASL
 # define SASLminc(a) (a)
@@ -33,8 +34,8 @@
     X("version", 0, VERSIONSW) \
     X("help", 0, HELPSW) \
     X("client host", -6, CLIESW) \
-    X("server host", -6, SERVSW) \
-    X("snoop", -5, SNOOPSW) \
+    X("server host", 0, SERVSW) \
+    X("snoop", 0, SNOOPSW) \
     X("sasl", SASLminc(4), SASLSW) \
     X("saslmech mechanism", SASLminc(-5), SASLMECHSW) \
     X("user username", SASLminc(-4), USERSW) \
@@ -63,7 +64,7 @@ main (int argc, char **argv)
     char *msg = NULL, **ap, **argp, backup[BUFSIZ];
     char buf[BUFSIZ], **arguments, *vec[MAXARGS];
 
-    if (nmh_init(argv[0], 1)) { return 1; }
+    if (nmh_init(argv[0], 2)) { return 1; }
 
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;
@@ -142,15 +143,14 @@ main (int argc, char **argv)
        }
        if (msg)
            adios (NULL, "only one draft at a time!");
-       else
-           vec[vecp++] = msg = cp;
+        vec[vecp++] = msg = cp;
     }
 
     /* allow Aliasfile: profile entry */
     if ((cp = context_find ("Aliasfile"))) {
        char *dp = NULL;
 
-       for (ap = brkstring(dp = getcpy(cp), " ", "\n"); ap && *ap; ap++) {
+       for (ap = brkstring(dp = mh_xstrdup(cp), " ", "\n"); ap && *ap; ap++) {
            vec[vecp++] = "-alias";
            vec[vecp++] = *ap;
        }
@@ -181,7 +181,8 @@ main (int argc, char **argv)
 
     switch (distsw ? child_id : OK) {
        case NOTOK:
-           advise (NULL, "unable to fork, so checking directly...");
+           inform("unable to fork, so checking directly...");
+           /* FALLTHRU */
        case OK:
            execvp (postproc, vec);
            fprintf (stderr, "unable to exec ");