comparison tools/lib64util.c @ 2242:65a2c2e99c81

Move listing of C64 formats function to argShowC64Formats in lib64util.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 15 Jun 2019 07:55:26 +0300
parents e2c6af0c9431
children b26e37e7cbe6
comparison
equal deleted inserted replaced
2241:587eb90459f9 2242:65a2c2e99c81
112 } 112 }
113 fprintf(fp, "\n"); 113 fprintf(fp, "\n");
114 } 114 }
115 115
116 116
117 void argShowC64Formats(FILE *fp, const BOOL rw)
118 {
119 fprintf(fp,
120 "Available C64 bitmap formats (-f <frmt>):\n"
121 " frmt %s| Type | Description\n"
122 "------%s+-----------------+-------------------------------------\n",
123 rw ? "| RW " : "",
124 rw ? "+----" : ""
125 );
126
127 for (int i = 0; i < ndmC64ImageFormats; i++)
128 {
129 const DMC64ImageFormat *fmt = dmC64ImageFormatsSorted[i];
130 char buf[64];
131
132 fprintf(fp, "%-6s",
133 fmt->fext);
134
135 if (rw)
136 {
137 fprintf(fp, "| %c%c ",
138 (fmt->flags & DM_FMT_RD) ? 'R' : ' ',
139 (fmt->flags & DM_FMT_WR) ? 'W' : ' '
140 );
141 }
142
143 fprintf(fp,
144 "| %-15s | %s%s\n",
145 dmC64GetImageTypeString(buf, sizeof(buf), fmt->format->type, FALSE),
146 fmt->name,
147 fmt->flags & DM_FMT_BROKEN ? " [BROKEN]" : "");
148 }
149
150 fprintf(fp, "%d formats supported.\n", ndmC64ImageFormats);
151 }
152
153
117 BOOL argHandleC64PaletteOption(char *optArg, DMC64Palette **ppal, char **palFile) 154 BOOL argHandleC64PaletteOption(char *optArg, DMC64Palette **ppal, char **palFile)
118 { 155 {
119 if (strcasecmp(optArg, "help") == 0 || 156 if (strcasecmp(optArg, "help") == 0 ||
120 strcasecmp(optArg, "list") == 0) 157 strcasecmp(optArg, "list") == 0)
121 { 158 {