From 99a4c450d1e3318e8335db32bf4a4857814fcdb2 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Tue, 4 Oct 2022 09:14:16 -0400 Subject: reset optind to enable getopt to not interfere with application operation (where loading the fifo in the child process depends on the values from the second getopt and optind) --- experimental/keyboard-leds-trayicons.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/experimental/keyboard-leds-trayicons.c b/experimental/keyboard-leds-trayicons.c index 9e32822..3dea691 100644 --- a/experimental/keyboard-leds-trayicons.c +++ b/experimental/keyboard-leds-trayicons.c @@ -654,7 +654,7 @@ typedef struct { } configuration; // this should be configurable with -c parameter (getopts?) -char* conffile = "NONE"; +char* conffile = "none"; int debug = 0; // slightly modified from example https://github.com/benhoyt/inih @@ -719,7 +719,7 @@ int fprint_usage(char **argv) { int main(int argc, char **argv) { - conffile = "/home/bgstack15/keyboard-leds-trayicons.conf"; + conffile = "none"; // Step 0: parse parameters int c; @@ -738,6 +738,8 @@ int main(int argc, char **argv) { fprintf(stderr, "Unknown option: %c\n", optopt); return 1; }; + // must reset this for the inner getopt/optint operations to proceed. This is somehow a globally-scoped variable. + optind = 0; // Step 1: load config configuration config; -- cgit