- invo_name = r1bindex (argv[0], '/');
-
- /* foil search of user profile/context */
- if (context_foil (NULL) == -1)
- done (1);
-
- mts_init (invo_name);
- arguments = getarguments (invo_name, argc, argv, 0);
- argp = arguments;
-
- 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] file", invo_name);
- print_help (buf, switches, 1);
- done (1);
- case VERSIONSW:
- print_version(invo_name);
- done (1);
-
- case DEBUGSW:
- debug++;
- continue;
-
- case DISTSW:
- msgstate = resent;
- continue;
-
- case WHOMSW:
- whomflg++;
- continue;
-
- case FILTSW:
- if (!(filter = *argp++) || *filter == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- continue;
- case NFILTSW:
- filter = NULL;
- continue;
-
- case REMVSW:
- rmflg++;
- continue;
- case NREMVSW:
- rmflg = 0;
- continue;
-
- case BACKSW:
- backflg++;
- continue;
- case NBACKSW:
- backflg = 0;
- continue;
-
- case VERBSW:
- verbose++;
- continue;
- case NVERBSW:
- verbose = 0;
- continue;
-
- case WATCSW:
- watch++;
- continue;
- case NWATCSW:
- watch = 0;
- continue;
-
- case PUSHSW:
- pushflg++;
- continue;
- case NPUSHSW:
- pushflg = 0;
- continue;
-
- case ALIASW:
- if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- if (aliasflg < 0)
- alias (AliasFile);/* load default aka's */
- aliasflg = 1;
- if ((state = alias(cp)) != AK_OK)
- adios (NULL, "aliasing error in file %s - %s",
- cp, akerror(state) );
- continue;
- case NALIASW:
- aliasflg = 0;
- continue;
-
- case WIDTHSW:
- if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- outputlinelen = atoi (cp);
- if (outputlinelen <= 10)
- outputlinelen = 72;
- continue;
-
- case LIBSW:
- if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- /* create a minimal context */
- if (context_foil (cp) == -1)
- done(1);
- continue;
-
- case ANNOSW:
- /* -idanno switch ignored */
- if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
- continue;
- }
+ invo_name = mhbasename(argv[0]);
+
+ /* foil search of user profile/context */
+ if (context_foil(NULL) == -1)
+ done(1);
+
+ arguments = getarguments(invo_name, argc, argv, 0);
+ argp = arguments;
+
+ 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] file",
+ invo_name);
+ print_help(buf, switches, 1);
+ done(1);
+ case VERSIONSW:
+ print_version(invo_name);
+ done(1);
+
+ case DEBUGSW:
+ debug++;
+ continue;
+
+ case DISTSW:
+ msgstate = resent;
+ continue;
+
+ case VERBSW:
+ verbose++;
+ continue;
+ case NVERBSW:
+ verbose = 0;
+ continue;
+
+ case WATCSW:
+ watch++;
+ continue;
+ case NWATCSW:
+ watch = 0;
+ continue;
+
+ case PUSHSW:
+ pushflg++;
+ continue;
+ case NPUSHSW:
+ pushflg = 0;
+ continue;
+
+ case ALIASW:
+ if (!(cp = *argp++) || *cp == '-')
+ adios(NULL, "missing argument to %s",
+ argp[-2]);
+ aliasflg = 1;
+ if ((state = alias(cp)) != AK_OK)
+ adios(NULL, "aliasing error in file %s - %s", cp, akerror(state));
+ continue;
+ case NALIASW:
+ aliasflg = 0;
+ continue;
+
+ case LIBSW:
+ if (!(cp = *argp++) || *cp == '-')
+ adios(NULL, "missing argument to %s",
+ argp[-2]);
+ /* create a minimal context */
+ if (context_foil(cp) == -1)
+ done(1);
+ continue;
+ }
+ }
+ if (msg)
+ adios(NULL, "only one message at a time!");
+ else
+ msg = cp;