diff options
author | B. Stack <bgstack15@gmail.com> | 2022-10-04 09:14:16 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-10-04 09:15:26 -0400 |
commit | 99a4c450d1e3318e8335db32bf4a4857814fcdb2 (patch) | |
tree | 186f239c67dbc9454a9f36f8a2af4f9e3c90414a /experimental | |
parent | WIP: add getopt (diff) | |
download | keyboard-leds-trayicons-99a4c450d1e3318e8335db32bf4a4857814fcdb2.tar.gz keyboard-leds-trayicons-99a4c450d1e3318e8335db32bf4a4857814fcdb2.tar.bz2 keyboard-leds-trayicons-99a4c450d1e3318e8335db32bf4a4857814fcdb2.zip |
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)
Diffstat (limited to 'experimental')
-rw-r--r-- | experimental/keyboard-leds-trayicons.c | 6 |
1 files 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; |