Changed exit status of each nmh command's -version and -help switches
[mmh] / uip / whom.c
index 5a82534..5f0eefd 100644 (file)
@@ -2,13 +2,27 @@
 /*
  * whom.c -- report to whom a message would be sent
  *
- * $Id$
+ * This code is Copyright (c) 2002, by the authors of nmh.  See the
+ * COPYRIGHT file in the root directory of the nmh distribution for
+ * complete copyright information.
  */
 
 #include <h/mh.h>
 #include <h/signals.h>
 #include <signal.h>
 
+#ifndef CYRUS_SASL
+# define SASLminc(a) (a)
+#else /* CYRUS_SASL */
+# define SASLminc(a)  0
+#endif /* CYRUS_SASL */
+
+#ifndef TLS_SUPPORT
+# define TLSminc(a)  (a)
+#else /* TLS_SUPPORT */
+# define TLSminc(a)   0
+#endif /* TLS_SUPPORT */
+
 static struct swit switches[] = {
 #define        ALIASW              0
     { "alias aliasfile", 0 },
@@ -27,13 +41,25 @@ static struct swit switches[] = {
 #define VERSIONSW           7
     { "version", 0 },
 #define        HELPSW              8
-    { "help", 4 },
+    { "help", 0 },
 #define        CLIESW              9
     { "client host", -6 },
 #define        SERVSW             10
     { "server host", -6 },
 #define        SNOOPSW            11
     { "snoop", -5 },
+#define SASLSW             12
+    { "sasl", SASLminc(4) },
+#define SASLMECHSW         13
+    { "saslmech mechanism", SASLminc(-5) },
+#define USERSW             14
+    { "user username", SASLminc(-4) },
+#define PORTSW            15
+    { "port server port name/number", 4 },
+#define TLSSW             16
+    { "tls", TLSminc(-3) },
+#define NTLSSW             17
+    { "notls", TLSminc(-5) },
     { NULL, 0 }
 };
 
@@ -64,6 +90,9 @@ main (int argc, char **argv)
     vec[vecp++] = "-library";
     vec[vecp++] = getcpy (m_maildir (""));
 
+    /* Don't need to feed fileproc or mhlproc to post because
+       it doesn't use them when used for whom. */
+
     while ((cp = *argp++)) {
        if (*cp == '-') {
            switch (smatch (++cp, switches)) {
@@ -76,14 +105,17 @@ main (int argc, char **argv)
                case HELPSW: 
                    snprintf (buf, sizeof(buf), "%s [switches] [file]", invo_name);
                    print_help (buf, switches, 1);
-                   done (1);
+                   done (0);
                case VERSIONSW:
                    print_version(invo_name);
-                   done (1);
+                   done (0);
 
                case CHKSW: 
                case NOCHKSW: 
                case SNOOPSW:
+               case SASLSW:
+               case TLSSW:
+               case NTLSSW:
                    vec[vecp++] = --cp;
                    continue;
 
@@ -113,6 +145,9 @@ main (int argc, char **argv)
                case ALIASW: 
                case CLIESW: 
                case SERVSW: 
+               case USERSW:
+               case PORTSW:
+               case SASLMECHSW:
                    vec[vecp++] = --cp;
                    if (!(cp = *argp++) || *cp == '-')
                        adios (NULL, "missing argument to %s", argp[-2]);