Moved -h/-? handling to preParseOptions().

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1441 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2005-01-10 08:49:05 +00:00
parent 06a3e566c2
commit 1935316a12
2 changed files with 16 additions and 14 deletions
+2
View File
@@ -1,4 +1,6 @@
Changes towards version 0.4: Changes towards version 0.4:
- Not initialising the various systems when -h/-? is supplied (bug #656),
from Nic
- F10 works when playing the intro (bug #665), from fOSSiL - F10 works when playing the intro (bug #665), from fOSSiL
- Game clock counter overflow fix (bug #668) - [collective effort] - Game clock counter overflow fix (bug #668) - [collective effort]
- Cocoa hooks for MacOS X, from Nic - Cocoa hooks for MacOS X, from Nic
+13 -13
View File
@@ -147,6 +147,12 @@ main (int argc, char *argv[])
UQM_MAJOR_VERSION, UQM_MINOR_VERSION, UQM_EXTRA_VERSION, UQM_MAJOR_VERSION, UQM_MINOR_VERSION, UQM_EXTRA_VERSION,
__DATE__, __TIME__); __DATE__, __TIME__);
if (options.runMode == runMode_usage)
{
usage (stdout);
return EXIT_SUCCESS;
}
/* mem_init () uses mutexes. Mutex creation cannot use /* mem_init () uses mutexes. Mutex creation cannot use
the memory system until the memory system is rewritten the memory system until the memory system is rewritten
to rely on a thread-safe allocator. to rely on a thread-safe allocator.
@@ -162,13 +168,6 @@ main (int argc, char *argv[])
return optionsResult; return optionsResult;
} }
if (options.runMode == runMode_usage)
{
usage(stdout);
// TODO: various uninitialisations
return EXIT_SUCCESS;
}
/* TODO: Once threading is gone, these become local variables /* TODO: Once threading is gone, these become local variables
again. In the meantime, they must be global so that again. In the meantime, they must be global so that
@@ -283,8 +282,9 @@ static int
preParseOptions(int argc, char *argv[], struct options_struct *options) preParseOptions(int argc, char *argv[], struct options_struct *options)
{ {
/* /*
"pre-process" the cmdline args looking for a -l ("logfile") * "pre-process" the cmdline args looking for a -l ("logfile")
option. If it was given, redirect stderr to the named file * option. If it was given, redirect stderr to the named file.
* Also handle the switches were normal operation is inhibited.
*/ */
opterr = 0; opterr = 0;
for (;;) for (;;)
@@ -300,6 +300,10 @@ preParseOptions(int argc, char *argv[], struct options_struct *options)
options->logFile = optarg; options->logFile = optarg;
break; break;
} }
case '?':
case 'h':
options->runMode = runMode_usage;
return EXIT_SUCCESS;
} }
} }
optind = 1; optind = 1;
@@ -533,10 +537,6 @@ parseOptions(int argc, char *argv[], struct options_struct *options)
longOptions[optionIndex].name); longOptions[optionIndex].name);
badArg = TRUE; badArg = TRUE;
break; break;
case '?':
case 'h':
options->runMode = runMode_usage;
return EXIT_SUCCESS;
break; break;
} }
} }