# HG changeset patch # User Matti Hamalainen # Date 1526188976 -10800 # Node ID 04769fa39dd44d40e4a8670173e0e823b6a6ee01 # Parent 7e6af32c8032e706f95ab2b2adddb298008c2834 Instead of specifying forced input format (-f) as a number in 64vw, use format extension like it is done in gfxconv. diff -r 7e6af32c8032 -r 04769fa39dd4 tools/64vw.c --- a/tools/64vw.c Sun May 13 07:56:47 2018 +0300 +++ b/tools/64vw.c Sun May 13 08:22:56 2018 +0300 @@ -53,8 +53,8 @@ { const DMC64ImageFormat *fmt = &dmC64ImageFormats[i]; char buf[64]; - printf("%3d | %-5s | %-15s | %s\n", - i, fmt->fext, + printf(" %-5s | %-15s | %s\n", + fmt->fext, dmC64GetImageTypeString(buf, sizeof(buf), fmt->type, FALSE), fmt->name); } @@ -100,22 +100,22 @@ break; case 4: + optForcedFormat = -1; + for (int i = 0; i < ndmC64ImageFormats; i++) { - int i; - if (sscanf(optArg, "%d", &i) == 1) + const DMC64ImageFormat *fmt = &dmC64ImageFormats[i]; + if (fmt->fext != NULL && + strcasecmp(optArg, fmt->fext) == 0) { - if (i < 0 || i >= ndmC64ImageFormats) - { - dmErrorMsg("Invalid image format index %d, see help for valid values.\n", i); - return FALSE; - } optForcedFormat = i; + break; } - else - { - dmErrorMsg("Invalid image format argument '%s'.\n", optArg); - return FALSE; - } + } + + if (optForcedFormat < 0) + { + dmErrorMsg("Invalid image format argument '%s'.\n", optArg); + return FALSE; } break;