q3map2/help: add -help all
authorThomas Debesse <dev@illwieckz.net>
Mon, 3 May 2021 04:57:10 +0000 (06:57 +0200)
committerThomas Debesse <dev@illwieckz.net>
Mon, 3 May 2021 06:16:22 +0000 (08:16 +0200)
tools/quake3/q3map2/help.c

index f6974a6c30a6d25e3af590ae907290538d806885..56916b63741d5ef64853d54e8e43927882d994ca 100644 (file)
@@ -462,7 +462,8 @@ void HelpGames()
 void HelpMain(const char* arg)
 {
        printf("Usage: q3map2 [stage] [common options...] [stage options...] [stage source file]\n");
-       printf("       q3map2 -help [stage]\n\n");
+       printf("       q3map2 -help [stage]\n");
+       printf("       q3map2 -help all\n\n");
 
        static char termbuf[2048];
        char *termtype = getenv("TERM");
@@ -507,15 +508,29 @@ void HelpMain(const char* arg)
        if ( arg && strlen(arg) > 0 )
        {
                if ( arg[0] == '-' )
+               {
                        arg++;
+               }
+
+               if ( strcmp(arg, "all") == 0 )
+               {
+                       HelpOptions("Stages", 0, terminalColumns, stages, sizeof(stages)/sizeof(struct HelpOption));
 
-               unsigned i;
-               for ( i = 0; i < sizeof(stages)/sizeof(struct HelpOption); i++ )
+                       for ( unsigned i = 0; i < sizeof(stages)/sizeof(struct HelpOption); i++ )
+                       {
+                               help_funcs[i]();
+                       }
+                       return;
+               }
+
+               for ( unsigned i = 0; i < sizeof(stages)/sizeof(struct HelpOption); i++ )
+               {
                        if ( strcmp(arg, stages[i].name+1) == 0 )
                        {
                                help_funcs[i]();
                                return;
                        }
+               }
        }
 
        HelpOptions("Stages", 0, terminalColumns, stages, sizeof(stages)/sizeof(struct HelpOption));