Removed `-format string' switches but made -form accept `=formatstring'.
[mmh] / uip / dp.c
index a5accf5..66f0f42 100644 (file)
--- a/uip/dp.c
+++ b/uip/dp.c
 #define WIDTH 78
 #define WBUFSIZ BUFSIZ
 
-#define FORMAT "%<(nodate{text})error: %{text}%|%(putstr(pretty{text}))%>"
+#define FORMAT "=%<(nodate{text})error: %{text}%|%(putstr(pretty{text}))%>"
 
 static struct swit switches[] = {
 #define FORMSW  0
        { "form formatfile", 0 },
-#define FMTSW  1
-       { "format string", 5 },
-#define WIDTHSW  2
+#define WIDTHSW  1
        { "width columns", 0 },
-#define VERSIONSW  3
+#define VERSIONSW  2
        { "version", 0 },
-#define HELPSW  4
+#define HELPSW  3
        { "help", 0 },
        { NULL, 0 }
 };
@@ -50,7 +48,7 @@ int
 main(int argc, char **argv)
 {
        int datep = 0, width = 0, status = 0;
-       char *cp, *form = NULL, *format = NULL, *nfs;
+       char *cp, *form = NULL, *nfs;
        char buf[BUFSIZ], **argp, **arguments;
        char *dates[NDATES];
 
@@ -68,36 +66,32 @@ main(int argc, char **argv)
        while ((cp = *argp++)) {
                if (*cp == '-') {
                        switch (smatch(++cp, switches)) {
-                               case AMBIGSW:
-                                       ambigsw(cp, switches);
-                                       done(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);
-                               case VERSIONSW:
-                                       print_version(invo_name);
-                                       done(1);
-
-                               case FORMSW:
-                                       if (!(form = *argp++) || *form == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       format = NULL;
-                                       continue;
-                               case FMTSW:
-                                       if (!(format = *argp++) || *format == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       form = NULL;
-                                       continue;
-
-                               case WIDTHSW:
-                                       if (!(cp = *argp++) || *cp == '-')
-                                               adios(NULL, "missing argument to %s", argp[-2]);
-                                       width = atoi(cp);
-                                       continue;
+                       case AMBIGSW:
+                               ambigsw(cp, switches);
+                               done(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);
+                       case VERSIONSW:
+                               print_version(invo_name);
+                               done(1);
+
+                       case FORMSW:
+                               if (!(form = *argp++) || *form == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               continue;
+
+                       case WIDTHSW:
+                               if (!(cp = *argp++) || *cp == '-')
+                                       adios(NULL, "missing argument to %s",
+                                                       argp[-2]);
+                               width = atoi(cp);
+                               continue;
                        }
                }
                if (datep > NDATES)
@@ -111,7 +105,7 @@ main(int argc, char **argv)
                adios(NULL, "usage: %s [switches] dates ...", invo_name);
 
        /* get new format string */
-       nfs = new_fs(form, format, FORMAT);
+       nfs = new_fs(form, FORMAT);
 
        if (width == 0) {
                if ((width = sc_width()) < WIDTH / 2)