Mercurial > hg > dmlib
comparison tools/64vw.c @ 1570:04769fa39dd4
Instead of specifying forced input format (-f) as a number in 64vw,
use format extension like it is done in gfxconv.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 13 May 2018 08:22:56 +0300 |
parents | e81c8c7a348f |
children | ad771e94af25 |
comparison
equal
deleted
inserted
replaced
1569:7e6af32c8032 | 1570:04769fa39dd4 |
---|---|
51 printf("\nAvailable bitmap formats:\n"); | 51 printf("\nAvailable bitmap formats:\n"); |
52 for (int i = 0; i < ndmC64ImageFormats; i++) | 52 for (int i = 0; i < ndmC64ImageFormats; i++) |
53 { | 53 { |
54 const DMC64ImageFormat *fmt = &dmC64ImageFormats[i]; | 54 const DMC64ImageFormat *fmt = &dmC64ImageFormats[i]; |
55 char buf[64]; | 55 char buf[64]; |
56 printf("%3d | %-5s | %-15s | %s\n", | 56 printf(" %-5s | %-15s | %s\n", |
57 i, fmt->fext, | 57 fmt->fext, |
58 dmC64GetImageTypeString(buf, sizeof(buf), fmt->type, FALSE), | 58 dmC64GetImageTypeString(buf, sizeof(buf), fmt->type, FALSE), |
59 fmt->name); | 59 fmt->name); |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
98 } | 98 } |
99 } | 99 } |
100 break; | 100 break; |
101 | 101 |
102 case 4: | 102 case 4: |
103 { | 103 optForcedFormat = -1; |
104 int i; | 104 for (int i = 0; i < ndmC64ImageFormats; i++) |
105 if (sscanf(optArg, "%d", &i) == 1) | 105 { |
106 { | 106 const DMC64ImageFormat *fmt = &dmC64ImageFormats[i]; |
107 if (i < 0 || i >= ndmC64ImageFormats) | 107 if (fmt->fext != NULL && |
108 { | 108 strcasecmp(optArg, fmt->fext) == 0) |
109 dmErrorMsg("Invalid image format index %d, see help for valid values.\n", i); | 109 { |
110 return FALSE; | |
111 } | |
112 optForcedFormat = i; | 110 optForcedFormat = i; |
113 } | 111 break; |
114 else | 112 } |
115 { | 113 } |
116 dmErrorMsg("Invalid image format argument '%s'.\n", optArg); | 114 |
117 return FALSE; | 115 if (optForcedFormat < 0) |
118 } | 116 { |
117 dmErrorMsg("Invalid image format argument '%s'.\n", optArg); | |
118 return FALSE; | |
119 } | 119 } |
120 break; | 120 break; |
121 | 121 |
122 case 5: | 122 case 5: |
123 if (dmVerbosity < 1) | 123 if (dmVerbosity < 1) |