about summary refs log tree commit diff
path: root/converter
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2024-03-13 18:04:35 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2024-03-13 18:04:35 +0000
commit40d822b677466e569f60d0f376d157a69253b099 (patch)
treea9fbe3691392c3ad9fb8241f0d4c569fd80ebd75 /converter
parent3df835b227b49a058e8c6be74e1a9c7025d6b289 (diff)
downloadnetpbm-mirror-40d822b677466e569f60d0f376d157a69253b099.tar.gz
netpbm-mirror-40d822b677466e569f60d0f376d157a69253b099.tar.xz
netpbm-mirror-40d822b677466e569f60d0f376d157a69253b099.zip
add -verbose, clean up messages
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4873 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter')
-rw-r--r--converter/other/infotopam.c32
1 files changed, 17 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) {
 }
 
 
-