diff tools/gfxconv.c @ 2515:a40de347fcb0

Make c64 formats listing (optionally) more verbose. Handle --help a bit differently in gfxconv.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 12 May 2020 20:06:24 +0300
parents e1a71d9eaede
children 5fcc9f7b8ad8
line wrap: on
line diff
--- a/tools/gfxconv.c	Sat May 02 08:25:12 2020 +0300
+++ b/tools/gfxconv.c	Tue May 12 20:06:24 2020 +0300
@@ -132,7 +132,9 @@
         optOutFormat = -1,
         optItemCount = -1,
         optPlanedWidth = 1,
-        optForcedInSubFormat = -1;
+        optForcedInSubFormat = -1,
+        optShowHelp = 0;
+
 unsigned int optInSkip = 0;
 BOOL    optInSkipNeg = FALSE;
 
@@ -233,8 +235,6 @@
     "(Not all input->output combinations are actually supported.)\n"
     "\n"
     );
-
-    argShowC64Formats(stdout, TRUE);
 }
 
 
@@ -763,22 +763,11 @@
     switch (optN)
     {
         case 0:
-            argShowHelp();
-            exit(0);
+            optShowHelp = 1;
             break;
 
         case 3:
-            argShowHelp();
-            argShowFormats();
-            argShowC64PaletteHelp(stdout);
-
-            for (int n = 0; n < optListN; n++)
-            {
-                const char *str = argGetHelpTopic(optList[n].id);
-                if (str != NULL)
-                    fprintf(stdout, "\n%s\n", str);
-            }
-            exit(0);
+            optShowHelp = 2;
             break;
 
         case 1:
@@ -837,8 +826,7 @@
             break;
 
         case 18:
-            argShowFormats();
-            exit(0);
+            optShowHelp = 3;
             break;
 
         case 20:
@@ -2635,6 +2623,35 @@
         argHandleOpt, argHandleFile, OPTH_BAILOUT))
         exit(1);
 
+    switch (optShowHelp)
+    {
+        case 1:
+            argShowHelp();
+            exit(0);
+            break;
+
+        case 2:
+            argShowHelp();
+            argShowFormats();
+            argShowC64Formats(stdout, TRUE, TRUE);
+            argShowC64PaletteHelp(stdout);
+
+            for (int n = 0; n < optListN; n++)
+            {
+                const char *str = argGetHelpTopic(optList[n].id);
+                if (str != NULL)
+                    fprintf(stdout, "\n%s\n", str);
+            }
+            exit(0);
+            break;
+
+        case 3:
+            argShowFormats();
+            argShowC64Formats(stdout, TRUE, dmVerbosity > 0);
+            exit(0);
+            break;
+    }
+
     // Determine input format, if not specified
     if (optInType == FFMT_AUTO && optInFilename != NULL)
     {