mirror of
https://git.zap.org.au/git/trader.git
synced 2024-11-03 17:27:29 -05:00
Minor code cleanups
This commit is contained in:
parent
9f02f8e77f
commit
6ee474e438
@ -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;
|
||||
|
23
src/trader.c
23
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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user