- 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 [+folder] [msgs] [switches]",
- invo_name);
- print_help (buf, switches, 1);
- done (1);
- case VERSIONSW:
- print_version(invo_name);
- done (1);
-
- case CLRSW:
- clearflag++;
- continue;
- case NCLRSW:
- clearflag = 0;
- continue;
-
- 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 HEADSW:
- hdrflag++;
- continue;
- case NHEADSW:
- hdrflag = 0;
- continue;
-
- case WIDTHSW:
- if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- width = atoi (cp);
- continue;
- case REVSW:
- revflag++;
- continue;
- case NREVSW:
- revflag = 0;
- continue;
-
- case FILESW:
- if (!(cp = *argp++) || (cp[0] == '-' && cp[1]))
- adios (NULL, "missing argument to %s", argp[-2]);
- if (strcmp (file = cp, "-"))
- file = path (cp, TFILE);
- continue;
+ switch (smatch(++cp, switches)) {
+ case AMBIGSW:
+ ambigsw(cp, switches);
+ exit(EX_USAGE);
+ case UNKWNSW:
+ adios(EX_USAGE, NULL, "-%s unknown", cp);
+
+ case HELPSW:
+ snprintf(buf, sizeof(buf), "%s [+folder] [msgs] [switches]", invo_name);
+ print_help(buf, switches, 1);
+ exit(argc == 2 ? EX_OK : EX_USAGE);
+ case VERSIONSW:
+ print_version(invo_name);
+ exit(argc == 2 ? EX_OK : EX_USAGE);
+
+ case FORMSW:
+ if (!(form = *argp++) || *form == '-')
+ adios(EX_USAGE, NULL, "missing argument to %s",
+ argp[-2]);
+ continue;
+
+ case WIDTHSW:
+ if (!(cp = *argp++) || *cp == '-')
+ adios(EX_USAGE, NULL, "missing argument to %s",
+ argp[-2]);
+ width = atoi(cp);
+ continue;
+
+ case FILESW:
+ if (!(cp = *argp++) || (cp[0] == '-' && cp[1]))
+ adios(EX_USAGE, NULL, "missing argument to %s",
+ argp[-2]);
+ if (strcmp(file = cp, "-")!=0)
+ file = mh_xstrdup(expanddir(cp));
+ continue;