diff --git a/src/help.c b/src/help.c index 7b5ae1c..db2e6ae 100644 --- a/src/help.c +++ b/src/help.c @@ -163,9 +163,8 @@ void show_help (void) // Count how many pages appear in the help text - for (numpages = 0; help_text[numpages] != NULL; numpages++) { + for (numpages = 0; help_text[numpages] != NULL; numpages++) ; - } if (numpages == 0) return; @@ -196,8 +195,7 @@ void show_help (void) case '^': // Set the current attribute - s++; - switch (*s) { + switch (*++s) { case '^': waddch(curwin, *s | curattr); break; @@ -255,8 +253,7 @@ void show_help (void) case '~': // Print a global constant - s++; - switch (*s) { + switch (*++s) { case '~': waddch(curwin, *s | curattr); break; diff --git a/src/trader.c b/src/trader.c index 8d70e40..4a7541b 100644 --- a/src/trader.c +++ b/src/trader.c @@ -192,14 +192,10 @@ int main (int argc, char *argv[]) void process_cmdline (int argc, char *argv[]) { - int c; - char *p; - - // Process arguments starting with "-" or "--" opterr = true; while (true) { - c = getopt_long(argc, argv, options_short, options_long, NULL); + int c = getopt_long(argc, argv, options_short, options_long, NULL); if (c == EOF) break; @@ -226,12 +222,16 @@ void process_cmdline (int argc, char *argv[]) case OPTION_MAX_TURN: // --max-turn: specify the maximum turn number - option_max_turn = strtol(optarg, &p, 10); + { + char *p; - if (option_max_turn < MIN_MAX_TURN || p == NULL || *p != '\0') { - fprintf(stderr, "%s: invalid value for --max-turn: `%s'\n", - program_name(), optarg); - show_usage(EXIT_FAILURE); + option_max_turn = strtol(optarg, &p, 10); + + if (option_max_turn < MIN_MAX_TURN || p == NULL || *p != '\0') { + fprintf(stderr, "%s: invalid value for --max-turn: `%s'\n", + program_name(), optarg); + show_usage(EXIT_FAILURE); + } } break; @@ -354,9 +354,6 @@ void init_program (void) // Initialise locale-specific variables init_locale(); - // Initialise signal-handling functions - // @@@ To be completed - // Initialise the terminal display init_screen(); }