Fix uip/whom.c for C89 compatibility
[mmh] / uip / rcvpack.c
index 352f785..b4e37bd 100644 (file)
@@ -10,6 +10,9 @@
 #include <h/dropsbr.h>
 #include <h/rcvmail.h>
 #include <h/tws.h>
 #include <h/dropsbr.h>
 #include <h/rcvmail.h>
 #include <h/tws.h>
+#include <unistd.h>
+#include <locale.h>
+#include <sysexits.h>
 
 static struct swit switches[] = {
 #define VERSIONSW  0
 
 static struct swit switches[] = {
 #define VERSIONSW  0
@@ -19,6 +22,7 @@ static struct swit switches[] = {
        { NULL, 0 }
 };
 
        { NULL, 0 }
 };
 
+char *version=VERSION;
 
 int
 main(int argc, char **argv)
 
 int
 main(int argc, char **argv)
@@ -42,23 +46,23 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               exit(1);
+                               exit(EX_USAGE);
                        case UNKWNSW:
                        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);
 
                        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);
                        case VERSIONSW:
                                print_version(invo_name);
-                               exit(0);
+                               exit(argc == 2 ? EX_OK : EX_USAGE);
                        }
                }
                if (file)
                        }
                }
                if (file)
-                       adios(NULL, "only one file at a time!");
+                       adios(EX_USAGE, NULL, "only one file at a time!");
                else
                        file = cp;
        }
                else
                        file = cp;
        }