X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Ffmtdump.c;h=5266235a5dd39eb145307fbc72f9b64d16065749;hp=b59cf5c79645b7b4de8b3ee64b46dcb09217b9f3;hb=a87df3543d3bc128ba4079d1f95638476ba5ca50;hpb=002555d3d68d553044facbe4fad7bd008a42ac5e diff --git a/uip/fmtdump.c b/uip/fmtdump.c index b59cf5c..5266235 100644 --- a/uip/fmtdump.c +++ b/uip/fmtdump.c @@ -10,12 +10,14 @@ #include #include #include +#include +#include static struct swit switches[] = { #define FORMSW 0 { "form formatfile", 0 }, #define VERSIONSW 1 - { "version", 0 }, + { "Version", 0 }, #define HELPSW 2 { "help", 0 }, { NULL, 0 } @@ -46,9 +48,7 @@ main(int argc, char **argv) char buf[BUFSIZ], *fmtstr, **argp, **arguments; struct format *fmt; -#ifdef LOCALE setlocale(LC_ALL, ""); -#endif invo_name = mhbasename(argv[0]); /* read user profile/context */ @@ -62,29 +62,29 @@ main(int argc, char **argv) switch (smatch(++cp, switches)) { case AMBIGSW: ambigsw(cp, switches); - done(1); + exit(EX_USAGE); case UNKWNSW: - adios(NULL, "-%s unknown", cp); + adios(EX_USAGE, NULL, "-%s unknown", cp); case HELPSW: snprintf(buf, sizeof(buf), "%s [switches]", invo_name); print_help(buf, switches, 1); - done(1); + exit(argc == 2 ? EX_OK : EX_USAGE); case VERSIONSW: print_version(invo_name); - done(1); + exit(argc == 2 ? EX_OK : EX_USAGE); case FORMSW: if (!(form = *argp++) || *form == '-') - adios(NULL, "missing argument to %s", + adios(EX_USAGE, NULL, "missing argument to %s", argp[-2]); continue; } } if (form) - adios(NULL, "only one form at a time!"); + adios(EX_USAGE, NULL, "only one form at a time!"); else form = cp; } @@ -96,15 +96,14 @@ main(int argc, char **argv) fmt_compile(fmtstr, &fmt); fmt_dump(fmt); - done(0); - return 1; + return EX_OK; } static void fmt_dump(struct format *fmth) { int i; - register struct format *fmt, *addr; + struct format *fmt, *addr; /* Assign labels */ for (fmt = fmth; fmt; ++fmt) { @@ -132,7 +131,7 @@ fmt_dump(struct format *fmth) static void dumpone(struct format *fmt) { - register int i; + int i; if ((i = findlabel(fmt)) >= 0) printf("L%d:", i); @@ -313,7 +312,7 @@ dumpone(struct format *fmt) static int findlabel(struct format *addr) { - register int i; + int i; for (i = 0; i < lused; ++i) if (addr == lvec[i]) @@ -437,7 +436,7 @@ f_typestr(int t) static char * c_typestr(int t) { - register int i; + int i; static char buf[64]; buf[0] = '\0'; @@ -454,7 +453,7 @@ c_typestr(int t) static char * c_flagsstr(int t) { - register int i; + int i; static char buf[64]; buf[0] = '\0';