From 17955bd3039f1030560f40f3ed2c3c6f6e1710ec Mon Sep 17 00:00:00 2001 From: tth Date: Sat, 29 May 2021 09:33:38 +0200 Subject: [PATCH] we can list all the garbage... --- tools/mkfimg.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tools/mkfimg.c b/tools/mkfimg.c index 74fd16f..cbb348b 100644 --- a/tools/mkfimg.c +++ b/tools/mkfimg.c @@ -49,8 +49,6 @@ Type *type; fprintf(stderr, ">>> %s ( '%s' )\n", __func__, name); #endif -// #define TEST(str) ( ! strcmp(name, str) ) - for (type = types; type->code; type++) { if (!strcmp(name, type->name)) { return type->code; @@ -60,6 +58,16 @@ for (type = types; type->code; type++) { return -1; } /* --------------------------------------------------------------------- */ +static void list_types(void) +{ +Type *type; + +for (type = types; type->code; type++) { + puts(type->name); + } +exit(0); +} +/* --------------------------------------------------------------------- */ static void help(int lj) { int foo, cc; @@ -67,6 +75,7 @@ int foo, cc; puts("Usage:\tmkfimg [options] quux.fimg width height"); puts("\t-k N.N\tgive a float parameter"); +puts("\t-L\tlist howto's"); fputs("\t-t bla\thowto make the pic :\n\t\t| ", stdout); for (foo=cc=0; types[foo].code; foo++) { @@ -95,12 +104,13 @@ char *tname = "wtf?"; FloatImg fimg; -while ((opt = getopt(argc, argv, "hk:t:v")) != -1) { +while ((opt = getopt(argc, argv, "hk:Lt:v")) != -1) { switch(opt) { case 'h': help(0); break; case 'k': fvalue = atof(optarg); break; case 't': type = get_type_by_name(tname=optarg); break; + case 'L': list_types(); break; case 'v': verbosity++; break; } }