X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=main.c;h=0d9fe04a9f8c043b845c2c1193c78d263f1a56a4;hb=32c928ab6d527199b4404f9789ae8e7a4818e06f;hp=73e813d554d0f467c1aeb93223a371a22d85553b;hpb=d09ccba5d63b46f6027417780080ba8d710b995c;p=xonotic%2Fgmqcc.git diff --git a/main.c b/main.c index 73e813d..0d9fe04 100644 --- a/main.c +++ b/main.c @@ -229,6 +229,31 @@ static bool options_parse(int argc, char **argv) { con_change(redirout, redirerr); continue; } + + /* show defaults (like pathscale) */ + if (!strcmp(argv[0]+1, "show-defaults")) { + size_t itr; + char buffer[1024]; + for (itr = 0; itr < COUNT_FLAGS; ++itr) { + if (!OPTS_FLAG(itr)) + continue; + + memset(buffer, 0, sizeof(buffer)); + util_strtononcmd(opts_flag_list[itr].name, buffer, strlen(opts_flag_list[itr].name) + 1); + + con_out("-f%s ", buffer); + } + for (itr = 0; itr < COUNT_WARNINGS; ++itr) { + if (!OPTS_WARN(itr)) + continue; + + memset(buffer, 0, sizeof(buffer)); + util_strtononcmd(opts_warn_list[itr].name, buffer, strlen(opts_warn_list[itr].name) + 1); + con_out("-W%s ", buffer); + } + con_out("\n"); + exit(0); + } if (!strcmp(argv[0]+1, "debug")) { opts_debug = true; @@ -265,7 +290,7 @@ static bool options_parse(int argc, char **argv) { /* handle all -fflags */ case 'f': util_strtocmd(argv[0]+2, argv[0]+2, strlen(argv[0]+2)+1); - if (!strcmp(argv[0]+2, "HELP")) { + if (!strcmp(argv[0]+2, "HELP") || *(argv[0]+2) == '?') { con_out("Possible flags:\n"); for (itr = 0; itr < COUNT_FLAGS; ++itr) { util_strtononcmd(opts_flag_list[itr].name, buffer, sizeof(buffer)); @@ -286,7 +311,7 @@ static bool options_parse(int argc, char **argv) { break; case 'W': util_strtocmd(argv[0]+2, argv[0]+2, strlen(argv[0]+2)+1); - if (!strcmp(argv[0]+2, "HELP")) { + if (!strcmp(argv[0]+2, "HELP") || *(argv[0]+2) == '?') { con_out("Possible warnings:\n"); for (itr = 0; itr < COUNT_WARNINGS; ++itr) { util_strtononcmd(opts_warn_list[itr].name, buffer, sizeof(buffer));