diff tools/64vw.c @ 2408:60e119262c67

Option index re-ordering cleanup work.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 13 Jan 2020 21:21:25 +0200
parents 6e86a048a760
children bc05bcfc4598
line wrap: on
line diff
--- a/tools/64vw.c	Mon Jan 13 21:16:57 2020 +0200
+++ b/tools/64vw.c	Mon Jan 13 21:21:25 2020 +0200
@@ -34,17 +34,18 @@
 
 static const DMOptArg optList[] =
 {
-    { 0, '?', "help",       "Show this help", OPT_NONE },
-    { 1, 'v', "verbose",    "Be more verbose", OPT_NONE },
-    { 2,   0, "fs",         "Fullscreen", OPT_NONE },
-    { 3, 'S', "scale",      "Scale image by factor (1-10)", OPT_ARGREQ },
-    { 4, 'f', "format",     "Force input format (see --formats)", OPT_ARGREQ },
-    { 5, 'F', "formats",    "List supported input formats", OPT_NONE },
-    { 6, 'i', "info",       "Print information only (no display)", OPT_NONE },
-    { 7, 'l', "list",       "List files that were recognized (implies -i)", OPT_NONE },
-    { 8, 'P', "probe",      "Probe only (do not attempt to decode the image)", OPT_NONE },
-    { 9,   0, "char-rom",   "Set character ROM file to be used.", OPT_ARGREQ },
-    {10, 'p', "palette" ,   "Set C64 palette to be used (see -p list).", OPT_ARGREQ },
+    {  0, '?', "help"            , "Show this help", OPT_NONE },
+    {  2, 'v', "verbose"         , "Be more verbose", OPT_NONE },
+
+    { 10,   0, "fs"              , "Fullscreen", OPT_NONE },
+    { 12, 'S', "scale"           , "Scale image by factor (1-10)", OPT_ARGREQ },
+    { 14, 'f', "format"          , "Force input format (see --formats)", OPT_ARGREQ },
+    { 16, 'F', "formats"         , "List supported input formats", OPT_NONE },
+    { 18, 'i', "info"            , "Print information only (no display)", OPT_NONE },
+    { 20, 'l', "list"            , "List files that were recognized (implies -i)", OPT_NONE },
+    { 22, 'P', "probe"           , "Probe only (do not attempt to decode the image)", OPT_NONE },
+    { 24,   0, "char-rom"        , "Set character ROM file to be used.", OPT_ARGREQ },
+    { 26, 'p', "palette"         , "Set C64 palette to be used (see -p list).", OPT_ARGREQ },
 };
 
 const int optListN = sizeof(optList) / sizeof(optList[0]);
@@ -90,15 +91,15 @@
             exit(0);
             break;
 
-        case 1:
+        case 2:
             dmVerbosity++;
             break;
 
-        case 2:
+        case 10:
             optVFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
             break;
 
-        case 3:
+        case 12:
             {
                 float factor;
                 if (sscanf(optArg, "%f", &factor) == 1)
@@ -119,7 +120,7 @@
             }
             break;
 
-        case 4:
+        case 14:
             optForcedFormat = -1;
             for (int i = 0; i < ndmC64ImageFormats; i++)
             {
@@ -139,32 +140,34 @@
             }
             break;
 
-        case 5:
+        case 16:
             argShowC64Formats(stdout, FALSE);
             exit(0);
             break;
 
-        case 7:
+        case 20:
+            // NOTICE! This fallthrough is intentional for -l option!
+            // Take care if reordering the option indices.
             optListOnly = TRUE;
             // Fallthrough
 
-        case 6:
+        case 18:
             if (dmVerbosity < 1)
                 dmVerbosity = 1;
             optInfoOnly = TRUE;
             break;
 
-        case 8:
+        case 22:
             if (dmVerbosity < 1)
                 dmVerbosity = 1;
             optProbeOnly = TRUE;
             break;
 
-        case 9:
+        case 24:
             optCharROMFilename = optArg;
             break;
 
-        case 10:
+        case 26:
             return argHandleC64PaletteOption(optArg, &optC64Palette, &optC64PaletteFile);
 
         default: