From 40e4315ff8d6dca388240d9f4699333911149b48 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sun, 9 Jul 2023 08:23:42 +0100 Subject: More DOS friendly, report invalid options --- src/main.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src') 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)) -- cgit v1.2.3