From: Scott Worley Date: Wed, 13 Sep 2023 21:25:41 +0000 (-0700) Subject: Contemplate the possibility of multiple command line flags X-Git-Tag: v1.0.0~6 X-Git-Url: http://git.scottworley.com/tl-append/commitdiff_plain/d19cfb47a757887f104a3b2a659ee288083d88af Contemplate the possibility of multiple command line flags --- diff --git a/tl-append.c b/tl-append.c index e302fce..6cc068a 100644 --- a/tl-append.c +++ b/tl-append.c @@ -24,10 +24,13 @@ typedef struct { } conf_t; conf_t parse_command_line(int argc, char *argv[]) { - conf_t conf = {0}; + conf_t conf; + conf.interactive = 0; - if (argc == 2 && strcmp(argv[1], "-i") == 0 && isatty(2)) - conf.interactive = 1; + for (int i = 1; i < argc; i++) { + if (strcmp(argv[i], "-i") == 0 && isatty(2)) + conf.interactive = 1; + } return conf; }