diff options
Diffstat (limited to '')
-rw-r--r-- | libparser-generate.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/libparser-generate.c b/libparser-generate.c index 25fb8a9..cc03972 100644 --- a/libparser-generate.c +++ b/libparser-generate.c @@ -7,9 +7,16 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <libsimple-arg.h> -USAGE("main-rule"); + +static const char *argv0 = "libparser-generate"; + +static void +usage(void) +{ + fprintf(stderr, "usage: %s main-rule\n", argv0); + exit(1); +} #define eprintf(...) (fprintf(stderr, __VA_ARGS__), exit(1)) @@ -496,10 +503,16 @@ main(int argc, char *argv[]) size_t i, j; int cmp, err; - ARGBEGIN { - default: - usage(); - } ARGEND; + if (argc) { + argv0 = *argv++; + argc--; + } + if (argc && argv[0][0] == '-') { + if (argv[0][1] != '-' || argv[0][2]) + usage(); + argv++; + argc--; + } if (argc != 1 || !isidentifier(argv[0][0])) usage(); |