X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Ffmtdump.c;h=c9b28cf70a448a8c77d100d7afca88d3362d6c76;hb=43c31a90ba57b93a5504c39a28b9ef55a9b6e801;hp=dd5dbcb1e38a219f650e2a5412796544505ead1a;hpb=fede6e42d81ce34fd5c1bbe7fb2757b281c2573a;p=mmh diff --git a/uip/fmtdump.c b/uip/fmtdump.c index dd5dbcb..c9b28cf 100644 --- a/uip/fmtdump.c +++ b/uip/fmtdump.c @@ -10,6 +10,8 @@ #include #include #include +#include +#include static struct swit switches[] = { #define FORMSW 0 @@ -60,30 +62,29 @@ main(int argc, char **argv) switch (smatch(++cp, switches)) { case AMBIGSW: ambigsw(cp, switches); - /*sysexits.h EX_USAGE*/ - exit(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); - exit(0); + exit(argc == 2 ? EX_OK : EX_USAGE); case VERSIONSW: print_version(invo_name); - exit(0); + 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; } @@ -95,7 +96,7 @@ main(int argc, char **argv) fmt_compile(fmtstr, &fmt); fmt_dump(fmt); - return 0; + return EX_OK; } static void