X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Ffmtdump.c;h=fc94247c1880021d8e8147fc21121a35ec361685;hp=2096c64454a469f0de3338b4f4e7a42dbec0cd15;hb=32b2354dbaf4bf934936eb5b102a4a3d2fdd209a;hpb=714b5c530ece27ea2835a313013f5b770163403c diff --git a/uip/fmtdump.c b/uip/fmtdump.c index 2096c64..fc94247 100644 --- a/uip/fmtdump.c +++ b/uip/fmtdump.c @@ -14,11 +14,9 @@ static struct swit switches[] = { #define FORMSW 0 { "form formatfile", 0 }, -#define FMTSW 1 - { "format string", 5 }, -#define VERSIONSW 2 - { "version", 0 }, -#define HELPSW 3 +#define VERSIONSW 1 + { "Version", 0 }, +#define HELPSW 2 { "help", 0 }, { NULL, 0 } }; @@ -44,15 +42,14 @@ static void litputc(char); int main(int argc, char **argv) { - int ncomps; - char *cp, *form = NULL, *format = NULL; - char buf[BUFSIZ], *nfs, **argp, **arguments; + char *cp, *form = NULL; + char buf[BUFSIZ], *fmtstr, **argp, **arguments; struct format *fmt; #ifdef LOCALE setlocale(LC_ALL, ""); #endif - invo_name = r1bindex(argv[0], '/'); + invo_name = mhbasename(argv[0]); /* read user profile/context */ context_read(); @@ -63,30 +60,26 @@ 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]", 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 AMBIGSW: + ambigsw(cp, switches); + done(1); + case UNKWNSW: + adios(NULL, "-%s unknown", cp); + + case HELPSW: + snprintf(buf, sizeof(buf), "%s [switches]", + 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; } } @@ -99,8 +92,8 @@ main(int argc, char **argv) /* ** Get new format string. Must be before chdir(). */ - nfs = new_fs(form, format, FORMAT); - ncomps = fmt_compile(nfs, &fmt); + fmtstr = new_fs(form, FORMAT); + fmt_compile(fmtstr, &fmt); fmt_dump(fmt); done(0); @@ -409,9 +402,6 @@ f_typestr(int t) case FT_PARSEADDR: return("PARSEADDR"); case FT_FORMATADDR: return("FORMATADDR"); case FT_MYMBOX: return("MYMBOX"); -#ifdef FT_ADDTOSEQ - case FT_ADDTOSEQ: return("ADDTOSEQ"); -#endif case FT_SAVESTR: return("SAVESTR"); #ifdef FT_PAUSE case FT_PAUSE: return ("PAUSE");