From d1d94e62cec041991d7716232d31f81759b7d85a Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 17 Apr 2021 12:41:00 +0200 Subject: Do not require libsimple at all MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libparser-generate.c | 25 +++++++++++++++++++------ 1 file 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 #include #include -#include -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(); -- cgit v1.2.3-70-g09d2