You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by ms...@apache.org on 2004/05/27 13:07:13 UTC

svn commit: rev 20497 - incubator/spamassassin/trunk/spamc

Author: mss
Date: Thu May 27 04:07:12 2004
New Revision: 20497

Modified:
   incubator/spamassassin/trunk/spamc/spamc.c
Log:
* spamc now returns success if it was called with -h (like any good tool).
* In main, the return value of read_args is honored.
* Added a missing newline in the help I accidently removed before.


Modified: incubator/spamassassin/trunk/spamc/spamc.c
==============================================================================
--- incubator/spamassassin/trunk/spamc/spamc.c	(original)
+++ incubator/spamassassin/trunk/spamc/spamc.c	Thu May 27 04:07:12 2004
@@ -104,7 +104,7 @@
     usg("Usage: spamc [options] [-e command [args]] < message\n");
     usg("Options:\n");
 
-    usg("  -d host             Specify host to connect to."
+    usg("  -d host             Specify host to connect to.\n"
         "                      [default: localhost]\n");
     usg("  -H                  Randomize IP addresses for the looked-up\n"
         "                      hostname.\n");
@@ -139,6 +139,7 @@
     usg("  -e command [args]   Pipe the output to the given command instead\n"
         "                      of stdout. This must be the last option.\n");
     usg("  -h                  Print this help message and exit.\n");
+    usg("\n");
 }
 
 int
@@ -152,6 +153,7 @@
     const char *opts = "-BcrRd:fhyp:t:s:u:xSHEl";
 #endif
     int opt;
+    int ret = EX_OK;
 
     while ((opt = getopt(argc, argv, opts)) != -1)
     {
@@ -265,19 +267,20 @@
             }
             
             case '?':
+            case ':':
             {
                 libspamc_log (flags, LOG_ERR, "invalid usage");
+                ret = EX_USAGE;
                 /* FALLTHROUGH */
             }
             case 'h':
-            case 1:
             {
                 print_usage();
-                exit(EX_USAGE);
+                exit(ret);
             }
         }
     }
-    return EX_OK;
+    return ret;
 }
 
 void get_output_fd(int *fd)
@@ -354,7 +357,8 @@
     signal(SIGPIPE, SIG_IGN);
 #endif
 
-    read_args(argc, argv, &max_size, &username, &trans);
+   if ((ret = read_args(argc, argv, &max_size, &username, &trans)) != EX_OK)
+       return ret;
 
   /*--------------------------------------------------------------------
    * DETERMINE USER