From 40d822b677466e569f60d0f376d157a69253b099 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Wed, 13 Mar 2024 18:04:35 +0000 Subject: add -verbose, clean up messages git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4873 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/infotopam.c | 32 +++++++++++++++++--------------- doc/HISTORY | 3 +++ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/converter/other/infotopam.c b/converter/other/infotopam.c index f1150609..59fcbc75 100644 --- a/converter/other/infotopam.c +++ b/converter/other/infotopam.c @@ -29,10 +29,10 @@ * * The icon data has the following format: * - * BIT-PLANE planes, each with HEIGHT rows of (WIDTH +15) / 16 * 2 bytes - * length. + * BIT-PLANE planes, each with HEIGHT rows WIDTH bits long, rounded up to + * a multiple of 2 bytes. * - * So if you have a 9x3x2 icon, the icon data will look like this: + * So if you have a 9x3x2 icon, the icon data looks like this: * * aaaa aaaa a000 0000 * aaaa aaaa a000 0000 @@ -82,6 +82,7 @@ typedef struct CmdlineInfo_ { unsigned int forcecolor; pixel colors[4]; /* Colors to use for converted icons */ unsigned int selected; + unsigned int verbose; } CmdlineInfo; typedef struct IconInfo_ { @@ -146,11 +147,13 @@ parseCommandLine(int argc, /* Set command line options */ option_def_index = 0; /* Incremented by OPTENT3 */ - OPTENT3(0, "forcecolor", OPT_FLAG, NULL, &cmdlineP->forcecolor, + OPTENT3(0, "forcecolor", OPT_FLAG, NULL, &cmdlineP->forcecolor, 0); OPTENT3(0, "numcolors", OPT_UINT, &numcolors, &numcolorsSpec, 0); - OPTENT3(0, "selected", OPT_FLAG, NULL, &cmdlineP->selected, + OPTENT3(0, "selected", OPT_FLAG, NULL, &cmdlineP->selected, + 0); + OPTENT3(0, "verbose", OPT_FLAG, NULL, &cmdlineP->verbose, 0); opt.opt_table = option_def; @@ -470,9 +473,9 @@ main(int argc, const char **argv) { rc = fseek(info.ifP, skipCt, SEEK_CUR); if (rc < 0) { - pm_error("Cannot skip header information in file '%s'. " + pm_error("Failed to skip header information in input file. " "fseek() errno = %d (%s)", - cmdline.inputFileNm, errno, strerror(errno)); + errno, strerror(errno)); } } @@ -488,9 +491,9 @@ main(int argc, const char **argv) { rc = fseek(info.ifP, skipCt, SEEK_CUR); if (rc < 0) { - pm_error("Cannot skip to next icon in file '%s'. " + pm_error("Failed to skip to next icon input file. " "fseek() errno = %d (%s)", - cmdline.inputFileNm, errno, strerror(errno)); + errno, strerror(errno)); } /* Get dimensions for second icon */ getIconHeader(&info); @@ -498,11 +501,11 @@ main(int argc, const char **argv) { readIconData(info.ifP, info.width, info.height, info.depth, &info.icon); - pm_message("converting %s, version %d, %s icon: %d X %d X %d", - cmdline.inputFileNm, info.version, - cmdline.selected ? "second" : "first", - info.width, info.height, info.depth); - + if (cmdline.verbose) { + pm_message("Version %u .info file, %s icon: %uW x %uH x %u deep", + info.version, cmdline.selected ? "second" : "first", + info.width, info.height, info.depth); + } pam.size = sizeof(pam); pam.len = PAM_STRUCT_SIZE(tuple_type); pam.file = stdout; @@ -531,4 +534,3 @@ main(int argc, const char **argv) { } - diff --git a/doc/HISTORY b/doc/HISTORY index fee33239..5f8dd993 100644 --- a/doc/HISTORY +++ b/doc/HISTORY @@ -8,6 +8,9 @@ not yet BJH Release 11.06.00 pamcut: add -reportonly. + infotopam: Remove input file name from messages. Add -verbose + and issue informational message only if it is specified. + pamcut: fix incorrect output when rectangle to cut is entirely above the input image. Invisible junk after image. Always broken. (The ability to cut outside the input image was new in -- cgit 1.4.1