diff options
author | Mattias Andrée <maandree@kth.se> | 2021-04-17 12:41:00 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-04-17 12:41:00 +0200 |
commit | d1d94e62cec041991d7716232d31f81759b7d85a (patch) | |
tree | f64735823cb2459832b7b976e468486ac098763f /libparser-generate.c | |
parent | Do not require libsimple at runtime (diff) | |
download | libparser-d1d94e62cec041991d7716232d31f81759b7d85a.tar.gz libparser-d1d94e62cec041991d7716232d31f81759b7d85a.tar.bz2 libparser-d1d94e62cec041991d7716232d31f81759b7d85a.tar.xz |
Do not require libsimple at all
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libparser-generate.c')
-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(); |