Updated: fixed command line parsing

This commit is contained in:
Lian Drake 2023-12-08 05:04:48 -04:00
parent 569dd8832e
commit 62a2ee9db3
2 changed files with 6 additions and 6 deletions

BIN
serpent Executable file

Binary file not shown.

View file

@ -78,25 +78,25 @@ int main (int argc, char **argv) {
/* Command line parsing */
int option;
static const char* short_options = "chv";
static struct option long_options[] = {
static const char* shortOptions = "chv";
static struct option longOptions[] = {
{"show-controls", no_argument, NULL, 'c'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'v'},
{NULL, 0, NULL, 0}
};
while ((option = getopt_long (argc, argv, short_options, long_options, NULL)) != -1) {
while ((option = getopt_long (argc, argv, shortOptions, longOptions, NULL)) != -1) {
switch (option) {
case 'c':
argControls();
break;
return 0;
case 'h':
argHelp();
break;
return 0;
case 'v':
argVersion();
break;
return 0;
case '?':
fprintf(stderr, "Use '-h, --help' for help.\n");
return 1;