Reset getopt state when parsing arguments

This lets the application parse some arguments itself.
This commit is contained in:
Sebastian Krzyszkowiak 2020-04-11 00:10:42 +02:00
parent 4fd703f821
commit 9a2f26c609
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF

View file

@ -141,6 +141,7 @@ SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char*
{NULL, 0, NULL, 0}, {NULL, 0, NULL, 0},
}; };
optind = 1;
int opt; int opt;
while ((opt = getopt_long(argc, argv, "dfw", long_options, NULL)) != -1) { while ((opt = getopt_long(argc, argv, "dfw", long_options, NULL)) != -1) {
switch (opt) { switch (opt) {
@ -159,6 +160,7 @@ SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char*
break; break;
} }
} }
optind = 1;
game->show_console = game->config.debug.enabled; game->show_console = game->config.debug.enabled;
game->_priv.show_timeline = false; game->_priv.show_timeline = false;