]> git.draconx.ca Git - liblbx.git/blobdiff - src/lbximg.c
lbximg: Add an option to control the output filenames.
[liblbx.git] / src / lbximg.c
index 0a0057a9fedf038846587c33a591bf8ba05f8853..c88fc4e21bff29a5e14c56b3df599a06de1099b4 100644 (file)
@@ -38,6 +38,10 @@ static int verbose = 0;
 static char *outname = "out";
 static int usepalette = 1;
 
+enum {
+       OPT_PREFIX = UCHAR_MAX+1,
+};
+
 static void printusage(void)
 {
        puts("usage: lbximg [-i|-d] [-v] [-p palette_file] [-O override_file]"
@@ -332,19 +336,20 @@ int main(int argc, char **argv)
 
        static const char sopts[] = "idnvF:f:p:O:VH";
        static const struct option lopts[] = {
-               { "identify",   0, NULL, 'i' },
-               { "decode",     0, NULL, 'd' },
-               { "verbose",    0, NULL, 'v' },
-               { "file",       1, NULL, 'f' },
-               { "format",     1, NULL, 'F' },
-               { "palette",    1, NULL, 'p' },
-               { "override",   1, NULL, 'O' },
+               { "identify",      0, NULL, 'i' },
+               { "decode",        0, NULL, 'd' },
+               { "verbose",       0, NULL, 'v' },
+               { "file",          1, NULL, 'f' },
+               { "format",        1, NULL, 'F' },
+               { "palette",       1, NULL, 'p' },
+               { "override",      1, NULL, 'O' },
+               { "no-palette",    0, NULL, 'n' },
 
-               { "version",    0, NULL, 'V' },
-               { "usage",      0, NULL, 'U' },
-               { "help",       0, NULL, 'H' },
+               { "output-prefix", 1, NULL,  OPT_PREFIX },
 
-               { "no-palette", 0, NULL, 'n' },
+               { "version",       0, NULL, 'V' },
+               { "usage",         0, NULL, 'U' },
+               { "help",          0, NULL, 'H' },
 
                { 0 }
        };
@@ -385,6 +390,9 @@ int main(int argc, char **argv)
                                return EXIT_FAILURE;
                        }
                        break;
+               case OPT_PREFIX:
+                       outname = optarg;
+                       break;
                case 'V':
                        tool_version();
                        return EXIT_SUCCESS;