Replace done with exit at uip
[mmh] / uip / dp.c
index fa3a201..22e725c 100644 (file)
--- a/uip/dp.c
+++ b/uip/dp.c
@@ -18,7 +18,7 @@ static struct swit switches[] = {
 #define FORMSW  0
        { "form formatfile", 0 },
 #define VERSIONSW  1
-       { "version", 0 },
+       { "Version", 0 },
 #define HELPSW  2
        { "help", 0 },
        { NULL, 0 }
@@ -38,13 +38,11 @@ int
 main(int argc, char **argv)
 {
        int datep = 0, status = 0;
-       char *cp, *form = NULL, *nfs;
+       char *cp, *form = NULL, *fmtstr;
        char buf[BUFSIZ], **argp, **arguments;
        char *dates[NDATES];
 
-#ifdef LOCALE
        setlocale(LC_ALL, "");
-#endif
        invo_name = mhbasename(argv[0]);
 
        /* read user profile/context */
@@ -58,17 +56,18 @@ main(int argc, char **argv)
                        switch (smatch(++cp, switches)) {
                        case AMBIGSW:
                                ambigsw(cp, switches);
-                               done(1);
+                               /* sysexits.h EX_USAGE */
+                               exit(1);
                        case UNKWNSW:
                                adios(NULL, "-%s unknown", cp);
 
                        case HELPSW:
                                snprintf(buf, sizeof(buf), "%s [switches] dates ...", invo_name);
                                print_help(buf, switches, 1);
-                               done(1);
+                               exit(0);
                        case VERSIONSW:
                                print_version(invo_name);
-                               done(1);
+                               exit(0);
 
                        case FORMSW:
                                if (!(form = *argp++) || *form == '-')
@@ -89,9 +88,9 @@ main(int argc, char **argv)
                adios(NULL, "usage: %s [switches] dates ...", invo_name);
 
        /* get new format string */
-       nfs = new_fs(form, FORMAT);
+       fmtstr = new_fs(form, FORMAT);
 
-       fmt_compile(nfs, &fmt);
+       fmt_compile(fmtstr, &fmt);
 
        dat[0] = 0;
        dat[1] = 0;
@@ -103,8 +102,7 @@ main(int argc, char **argv)
                status += process(dates[datep]);
 
        context_save();  /* save the context file */
-       done(status);
-       return 1;
+       return status;
 }