From 2ebbe89ddf64a1cdaea65b4d49ffe668c6577e00 Mon Sep 17 00:00:00 2001 From: thing1 Date: Tue, 8 Apr 2025 09:53:29 +0100 Subject: made some additions that allow for better outputing of data --- gn.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'gn.c') diff --git a/gn.c b/gn.c index b56d934..f09b078 100644 --- a/gn.c +++ b/gn.c @@ -7,26 +7,10 @@ #include "tokens.h" #include "output.h" #include "util.h" - -typedef enum mode { - NONE = 0, - LIST = 1, - CHECK = 2, - OUTPUT = 4, - PRETTY = 8, -} mode; - -typedef enum outputformats { - GOATNOTE, - HTML, - GROFF, - TEXT, -} outputformats; +#include "opts.h" outputformats outputformat; - mode m = NONE; - token tokens[1024]; int tokcount = 0; @@ -80,13 +64,11 @@ int readuntil(char *file, int off, char end, types t) { } void usage() { - fprintf(stderr, - "usage: gn [-l -c -o format -p -H header -F footer -h] < note.gn\n" - ); - exit(1); + eprint("usage: gn [-l -c -o format -p -H header -F footer -h] < note.gn"); } int main(int argc, char **argv) { + if (argc <= 1) usage(); for (int i = 1; i < argc && argc != 1; i++) { if (strcmp(argv[i], "-l") == 0) m |= LIST; else if (strcmp(argv[i], "-c") == 0) m |= CHECK; -- cgit v1.2.3