Fix missing va_end call in uip/mhmisc.c
[mmh] / uip / rcvpack.c
index 4c271df..bd6bacb 100644 (file)
@@ -12,6 +12,7 @@
 #include <h/tws.h>
 #include <unistd.h>
 #include <locale.h>
+#include <sysexits.h>
 
 static struct swit switches[] = {
 #define VERSIONSW  0
@@ -44,23 +45,23 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               exit(1);
+                               exit(EX_USAGE);
                        case UNKWNSW:
-                               adios(NULL, "-%s unknown", cp);
+                               adios(EX_USAGE, NULL, "-%s unknown", cp);
 
                        case HELPSW:
                                snprintf(buf, sizeof(buf),
                                                "%s [switches] file",
                                                invo_name);
                                print_help(buf, switches, 1);
-                               exit(0);
+                               exit(argc == 2 ? EX_OK : EX_USAGE);
                        case VERSIONSW:
                                print_version(invo_name);
-                               exit(0);
+                               exit(argc == 2 ? EX_OK : EX_USAGE);
                        }
                }
                if (file)
-                       adios(NULL, "only one file at a time!");
+                       adios(EX_USAGE, NULL, "only one file at a time!");
                else
                        file = cp;
        }