aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-07-09 08:23:42 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-07-09 08:23:42 +0100
commit40e4315ff8d6dca388240d9f4699333911149b48 (patch)
tree16852c06aded4d9880bc8316003c8c7261ddd48e
parent231362ca6e7a292c350b98fcc144a844919aea41 (diff)
downloadgold-mine-run-40e4315ff8d6dca388240d9f4699333911149b48.tar.gz
gold-mine-run-40e4315ff8d6dca388240d9f4699333911149b48.zip
More DOS friendly, report invalid options
-rw-r--r--src/main.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index 0b45bbe..bf37ff3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -22,9 +22,9 @@ int _crt0_startup_flags = _CRT0_FLAG_LOCK_MEMORY;
static void run_help(const char *argv0)
{
printf("usage: %s\n\n"
- " -h\tthis help screen\n"
- " -v\tprint version and exit\n"
- " -ns\trun the game with no sound\n\n"
+ " -h, /? this help screen\n"
+ " -v print version and exit\n"
+ " -ns run the game with no sound\n\n"
"More info and updates:\n\n"
" " GAME_URL "\n\n",
argv0);
@@ -44,18 +44,24 @@ int main(int argc, char *argv[])
if (argc > 1)
{
for (uint8_t i = 1; i < argc; i++)
- if (!strcmp(argv[i], "-h"))
+ if (!strcmp(argv[i], "-h")
+ || !strcmp(argv[i], "/?"))
{
run_help(argv[0]);
return 0;
}
else if (!strcmp(argv[i], "-v"))
{
- printf(GAME_NAME " " GAME_VERSION "\n");
+ printf(GAME_NAME " version " GAME_VERSION "\n");
return 0;
}
else if (!strcmp(argv[i], "-ns"))
nosound = 1;
+ else
+ {
+ fprintf(stderr, "ERROR: invalid option, try -h\n");
+ return 1;
+ }
}
if (!sound_init(nosound))