1
0
mirror of https://git.zap.org.au/git/trader.git synced 2024-09-01 17:14:15 -04:00

Minor code cleanups

This commit is contained in:
John Zaitseff 2011-07-20 21:18:28 +10:00
parent 9f02f8e77f
commit 6ee474e438
2 changed files with 13 additions and 19 deletions

View File

@ -163,9 +163,8 @@ void show_help (void)
// Count how many pages appear in the help text // 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) if (numpages == 0)
return; return;
@ -196,8 +195,7 @@ void show_help (void)
case '^': case '^':
// Set the current attribute // Set the current attribute
s++; switch (*++s) {
switch (*s) {
case '^': case '^':
waddch(curwin, *s | curattr); waddch(curwin, *s | curattr);
break; break;
@ -255,8 +253,7 @@ void show_help (void)
case '~': case '~':
// Print a global constant // Print a global constant
s++; switch (*++s) {
switch (*s) {
case '~': case '~':
waddch(curwin, *s | curattr); waddch(curwin, *s | curattr);
break; break;

View File

@ -192,14 +192,10 @@ int main (int argc, char *argv[])
void process_cmdline (int argc, char *argv[]) void process_cmdline (int argc, char *argv[])
{ {
int c;
char *p;
// Process arguments starting with "-" or "--" // Process arguments starting with "-" or "--"
opterr = true; opterr = true;
while (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) if (c == EOF)
break; break;
@ -226,12 +222,16 @@ void process_cmdline (int argc, char *argv[])
case OPTION_MAX_TURN: case OPTION_MAX_TURN:
// --max-turn: specify the maximum turn number // --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') { option_max_turn = strtol(optarg, &p, 10);
fprintf(stderr, "%s: invalid value for --max-turn: `%s'\n",
program_name(), optarg); if (option_max_turn < MIN_MAX_TURN || p == NULL || *p != '\0') {
show_usage(EXIT_FAILURE); fprintf(stderr, "%s: invalid value for --max-turn: `%s'\n",
program_name(), optarg);
show_usage(EXIT_FAILURE);
}
} }
break; break;
@ -354,9 +354,6 @@ void init_program (void)
// Initialise locale-specific variables // Initialise locale-specific variables
init_locale(); init_locale();
// Initialise signal-handling functions
// @@@ To be completed
// Initialise the terminal display // Initialise the terminal display
init_screen(); init_screen();
} }