changeset 1666:94d45136a6fd

Add option to 64vw to list only filenames of recognized files (-l). Implies probe (-p).
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 30 May 2018 21:08:34 +0300
parents 0022e1a428ca
children 7f74073813c6
files tools/64vw.c
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tools/64vw.c	Wed May 30 18:11:31 2018 +0300
+++ b/tools/64vw.c	Wed May 30 21:08:34 2018 +0300
@@ -19,6 +19,7 @@
 int    optScrWidth, optScrHeight;
 int    optForcedFormat = -1;
 BOOL   optProbeOnly = FALSE;
+BOOL   optListOnly  = FALSE;
 size_t noptFilenames1 = 0, noptFilenames2 = 0;
 char   **optFilenames = NULL;
 
@@ -32,6 +33,7 @@
     { 4, 'f', "format",     "Force input format (see --formats)", OPT_ARGREQ },
     { 5, 'F', "formats",    "List supported input formats", OPT_NONE },
     { 6, 'p', "probe",      "Probe only (no display)", OPT_NONE },
+    { 7, 'l', "list",       "Output list of files that were recognized (implies -p)", OPT_NONE },
 };
 
 const int optListN = sizeof(optList) / sizeof(optList[0]);
@@ -133,6 +135,10 @@
             exit(0);
             break;
 
+        case 7:
+            optListOnly = TRUE;
+            // Fallthrough
+
         case 6:
             if (dmVerbosity < 1)
                 dmVerbosity = 1;
@@ -265,8 +271,16 @@
 
             if ((ret = dmReadC64Image(filename, forced, &fmt, &cimage)) != DMERR_OK)
             {
-                dmErrorMsg("Could not read image file '%s', %d: %s\n",
-                    filename, ret, dmErrorStr(ret));
+                if (!optListOnly)
+                {
+                    dmErrorMsg("Could not read image file '%s', %d: %s\n",
+                        filename, ret, dmErrorStr(ret));
+                }
+            }
+            else
+            if (optListOnly)
+            {
+                fprintf(stdout, "%s\n", filename);
             }
             else
             {