about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2024-03-12 21:18:23 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2024-03-12 21:18:23 +0000
commit3df835b227b49a058e8c6be74e1a9c7025d6b289 (patch)
tree2b99351076e55eefa37bacd49e5a82d18e5b53ca
parent65fc824d664ceb501985edee67b320173b9e789a (diff)
downloadnetpbm-mirror-3df835b227b49a058e8c6be74e1a9c7025d6b289.tar.gz
netpbm-mirror-3df835b227b49a058e8c6be74e1a9c7025d6b289.tar.xz
netpbm-mirror-3df835b227b49a058e8c6be74e1a9c7025d6b289.zip
cleanup
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4872 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/other/bmptopnm.c6
-rw-r--r--converter/other/fitstopnm.c5
-rw-r--r--converter/other/giftopnm.c7
-rw-r--r--converter/other/hdifftopam.c36
-rw-r--r--converter/other/pamtogif.c2
-rw-r--r--converter/other/pamtopdbimg.c6
-rw-r--r--converter/other/pamtopng.c2
-rw-r--r--converter/other/pamtopnm.c6
-rw-r--r--converter/other/pamtoqoi.c6
-rw-r--r--converter/other/pamtosrf.c6
-rw-r--r--converter/other/pamtotga.c2
-rw-r--r--converter/other/pamtotiff.c2
-rw-r--r--converter/other/pamtowinicon.c2
-rw-r--r--converter/other/pdbimgtopam.c6
-rw-r--r--converter/other/pgmtopbm.c6
-rw-r--r--converter/other/pgmtoppm.c7
-rw-r--r--converter/other/pngtopam.c6
-rw-r--r--converter/other/pnmtojpeg.c6
-rw-r--r--converter/other/pnmtopng.c6
-rw-r--r--converter/other/pnmtops.c2
-rw-r--r--converter/other/pnmtorle.c6
-rw-r--r--converter/other/qoitopam.c6
-rw-r--r--converter/other/rasttopnm.c6
-rw-r--r--converter/other/sgitopnm.c6
-rw-r--r--converter/other/srftopam.c6
-rw-r--r--converter/other/tifftopnm.c4
-rw-r--r--converter/other/winicontopam.c2
-rw-r--r--converter/other/xwdtopnm.c6
-rw-r--r--converter/other/yuy2topam.c5
29 files changed, 68 insertions, 106 deletions
diff --git a/converter/other/bmptopnm.c b/converter/other/bmptopnm.c
index eed428de..091d948a 100644
--- a/converter/other/bmptopnm.c
+++ b/converter/other/bmptopnm.c
@@ -140,9 +140,7 @@ parseCommandLine(int argc, const char ** argv,
    Note that the file spec array we return is stored in the storage that
    was passed to us as the argv array.
 -----------------------------------------------------------------------------*/
-    optEntry * option_def;
-        /* Instructions to OptParseOptions2 on how to parse our options.
-         */
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -156,7 +154,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (argc-1 == 0)
diff --git a/converter/other/fitstopnm.c b/converter/other/fitstopnm.c
index ca621164..90bd16f1 100644
--- a/converter/other/fitstopnm.c
+++ b/converter/other/fitstopnm.c
@@ -88,8 +88,7 @@ parseCommandLine(int argc, const char ** argv,
    Note that the strings we return are stored in the storage that
    was passed to us as the argv array.  We also trash *argv.
 --------------------------------------------------------------------------*/
-    optEntry * option_def;
-        /* Instructions to pm_optParseOptions3 on how to parse our options. */
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int imageSpec;
@@ -121,7 +120,7 @@ parseCommandLine(int argc, const char ** argv,
 
     /* Set some defaults the lazy way (using multiple setting of variables) */
 
-    pm_optParseOptions3(&argc, (char**)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (imageSpec) {
diff --git a/converter/other/giftopnm.c b/converter/other/giftopnm.c
index c1c79e26..55d7ccc6 100644
--- a/converter/other/giftopnm.c
+++ b/converter/other/giftopnm.c
@@ -113,10 +113,7 @@ parseCommandLine(int argc, const char ** argv,
    Note that the file spec array we return is stored in the storage that
    was passed to us as the argv array.
 -----------------------------------------------------------------------------*/
-    optEntry * option_def;
-        /* Instructions to pm_optParseOptions3 on how to parse our options.
-         */
-
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int alphaSpec, imageSpec;
@@ -144,7 +141,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = false;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = false;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     free(option_def);
diff --git a/converter/other/hdifftopam.c b/converter/other/hdifftopam.c
index 7464bb1a..1b058a78 100644
--- a/converter/other/hdifftopam.c
+++ b/converter/other/hdifftopam.c
@@ -10,15 +10,16 @@
 #include <stdio.h>
 
 #include "pm_c_util.h"
-#include "pam.h"
-#include "shhopt.h"
+#include "mallocvar.h"
 #include "nstring.h"
+#include "shhopt.h"
+#include "pam.h"
 
-struct cmdlineInfo {
+struct CmdlineInfo {
     /* All the information the user supplied in the command line,
        in a form easy for the program to use.
     */
-    const char *inputFilespec;  /* Filespecs of input files */
+    const char * inputFileNm;  /* Names of input files */
     unsigned int pnm;
     unsigned int verbose;
 };
@@ -26,19 +27,19 @@ struct cmdlineInfo {
 
 
 static void
-parseCommandLine(int argc, char ** argv,
-                 struct cmdlineInfo * const cmdlineP) {
+parseCommandLine(int argc, const char ** const argv,
+                 struct CmdlineInfo * const cmdlineP) {
 /*----------------------------------------------------------------------------
    Note that the file spec array we return is stored in the storage that
    was passed to us as the argv array.
 -----------------------------------------------------------------------------*/
-    optEntry *option_def = malloc( 100*sizeof( optEntry ) );
-        /* Instructions to pm_optParseOptions3 on how to parse our options.
-         */
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int option_def_index;
 
+    MALLOCARRAY_NOFAIL(option_def, 100);
+
     option_def_index = 0;   /* incremented by OPTENTRY */
     OPTENT3(0, "pnm",       OPT_FLAG,    NULL, &cmdlineP->pnm,      0);
     OPTENT3(0, "verbose",   OPT_FLAG,    NULL, &cmdlineP->verbose,  0);
@@ -47,13 +48,13 @@ parseCommandLine(int argc, char ** argv,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (argc-1 < 1)
-        cmdlineP->inputFilespec = "-";
+        cmdlineP->inputFileNm = "-";
     else if (argc-1 == 1)
-        cmdlineP->inputFilespec = argv[1];
+        cmdlineP->inputFileNm = argv[1];
     else
         pm_error("Too many arguments.");
 }
@@ -88,20 +89,21 @@ static void
 
 
 int
-main(int argc, char *argv[]) {
-    FILE *ifP;
-    struct cmdlineInfo cmdline;
+main(int argc, const char ** argv) {
+
+    FILE * ifP;
+    struct CmdlineInfo cmdline;
     struct pam diffpam, outpam;
     unsigned int row;
     tuple * diffrow;
     tuple * outrow;
     tuple * prevrow;
 
-    pnm_init(&argc, argv);
+    pm_proginit(&argc, argv);
 
     parseCommandLine(argc, argv, &cmdline);
 
-    ifP = pm_openr(cmdline.inputFilespec);
+    ifP = pm_openr(cmdline.inputFileNm);
 
     pnm_readpaminit(ifP, &diffpam, PAM_STRUCT_SIZE(tuple_type));
 
diff --git a/converter/other/pamtogif.c b/converter/other/pamtogif.c
index 03e6d049..c41c778c 100644
--- a/converter/other/pamtogif.c
+++ b/converter/other/pamtogif.c
@@ -172,7 +172,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (argc-1 == 0)
diff --git a/converter/other/pamtopdbimg.c b/converter/other/pamtopdbimg.c
index da0f5064..1ed08f9f 100644
--- a/converter/other/pamtopdbimg.c
+++ b/converter/other/pamtopdbimg.c
@@ -73,9 +73,7 @@ parseCommandLine(int argc, const char ** argv,
    Note that the strings we return are stored in the storage that
    was passed to us as the argv array.  We also trash *argv.
 -----------------------------------------------------------------------------*/
-    optEntry *option_def;
-        /* Instructions to pm_optParseOptions3 on how to parse our options.
-         */
+    optEntry * option_def;  /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -105,7 +103,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = false;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = false;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
 
diff --git a/converter/other/pamtopng.c b/converter/other/pamtopng.c
index 24eb1ca2..51203df5 100644
--- a/converter/other/pamtopng.c
+++ b/converter/other/pamtopng.c
@@ -218,7 +218,7 @@ parseCommandLine (int                  argc,
     opt.allowNegNum = false;  /* we have no parms that are negative numbers */
 
     /* uses and sets argc, argv, and some of *cmdlineP and others */
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
 
     if (cmdlineP->chromaSpec)
         parseChromaOpt(chroma, &cmdlineP->chroma);
diff --git a/converter/other/pamtopnm.c b/converter/other/pamtopnm.c
index 11e34b45..45ab1beb 100644
--- a/converter/other/pamtopnm.c
+++ b/converter/other/pamtopnm.c
@@ -33,9 +33,7 @@ parseCommandLine(int argc, const char ** argv,
    Note that the file spec array we return is stored in the storage that
    was passed to us as the argv array.
 -----------------------------------------------------------------------------*/
-    optEntry * option_def;
-        /* Instructions to OptParseOptions3 on how to parse our options.
-         */
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -49,7 +47,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (argc-1 == 0)
diff --git a/converter/other/pamtoqoi.c b/converter/other/pamtoqoi.c
index e3f87ae0..a188cca9 100644
--- a/converter/other/pamtoqoi.c
+++ b/converter/other/pamtoqoi.c
@@ -71,9 +71,7 @@ parseCommandLine(int                  argc,
    Note that the strings we return are stored in the storage that
    was passed to us as the argv array.  We also trash *argv.
 -----------------------------------------------------------------------------*/
-    optEntry * option_def;
-        /* Instructions to pm_optParseOptions3 on how to parse our options.
-         */
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -86,7 +84,7 @@ parseCommandLine(int                  argc,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (argc-1 < 1)
diff --git a/converter/other/pamtosrf.c b/converter/other/pamtosrf.c
index b62b19df..eb2d44bd 100644
--- a/converter/other/pamtosrf.c
+++ b/converter/other/pamtosrf.c
@@ -45,9 +45,7 @@ parseCommandLine(int argc, const char ** argv,
    Note that the strings we return are stored in the storage that
    was passed to us as the argv array.  We also trash *argv.
 -----------------------------------------------------------------------------*/
-  optEntry *option_def;
-      /* Instructions to pm_optParseOptions3 on how to parse our options.
-       */
+  optEntry * option_def;   /* Used by OPTENT3 */
   optStruct3 opt;
 
   unsigned int option_def_index;
@@ -62,7 +60,7 @@ parseCommandLine(int argc, const char ** argv,
   opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
   opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
 
-  pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+  pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
       /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
   if (argc-1 < 1)
diff --git a/converter/other/pamtotga.c b/converter/other/pamtotga.c
index f596a313..c0fb524a 100644
--- a/converter/other/pamtotga.c
+++ b/converter/other/pamtotga.c
@@ -82,7 +82,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdline_p and others. */
 
     if (cmap + cmap16 + mono + rgb > 1)
diff --git a/converter/other/pamtotiff.c b/converter/other/pamtotiff.c
index 4f25d93a..584cb840 100644
--- a/converter/other/pamtotiff.c
+++ b/converter/other/pamtotiff.c
@@ -236,7 +236,7 @@ parseCommandLine(int                 argc,
     opt.short_allowed = false;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = false;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char**)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
     /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (none + packbits + lzw + g3 + g4 + flate + adobeflate > 1)
diff --git a/converter/other/pamtowinicon.c b/converter/other/pamtowinicon.c
index 14b29f34..4d73ccdf 100644
--- a/converter/other/pamtowinicon.c
+++ b/converter/other/pamtowinicon.c
@@ -47,7 +47,7 @@ parseCommandLine(int argc, const char **argv,
     opt3.short_allowed = false;
     opt3.allowNegNum   = false;
 
-    pm_optParseOptions3(&argc, (char **)argv, opt3, sizeof(opt3), 0);
+    pm_optParseOptions4(&argc, argv, opt3, sizeof(opt3), 0);
 
     if (pngthresholdSpec) {
         if (UINT_MAX / cmdlineP->pngthreshold < cmdlineP->pngthreshold)
diff --git a/converter/other/pdbimgtopam.c b/converter/other/pdbimgtopam.c
index 4c064630..55a2ec70 100644
--- a/converter/other/pdbimgtopam.c
+++ b/converter/other/pdbimgtopam.c
@@ -64,9 +64,7 @@ parseCommandLine(int argc, const char ** argv,
    Note that the strings we return are stored in the storage that
    was passed to us as the argv array.  We also trash *argv.
 -----------------------------------------------------------------------------*/
-    optEntry *option_def;
-        /* Instructions to pm_optParseOptions3 on how to parse our options.
-         */
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -85,7 +83,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = false;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = false;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (!notefileSpec)
diff --git a/converter/other/pgmtopbm.c b/converter/other/pgmtopbm.c
index d5f67a06..b71904d8 100644
--- a/converter/other/pgmtopbm.c
+++ b/converter/other/pgmtopbm.c
@@ -47,9 +47,7 @@ parseCommandLine(int argc, const char ** argv,
    Note that the file spec array we return is stored in the storage that
    was passed to us as the argv array.
 -----------------------------------------------------------------------------*/
-    optEntry *option_def;
-        /* Instructions to pm_optParseOptions3 on how to parse our options.
-         */
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -83,7 +81,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We may have parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (floydOpt + thresholdOpt + hilbertOpt + dither8Opt +
diff --git a/converter/other/pgmtoppm.c b/converter/other/pgmtoppm.c
index dea6c4ca..822ddac7 100644
--- a/converter/other/pgmtoppm.c
+++ b/converter/other/pgmtoppm.c
@@ -48,9 +48,7 @@ parseCommandLine(int argc, const char ** argv,
    Note that the strings we return are stored in the storage that
    was passed to us as the argv array.  We also trash *argv.
 -----------------------------------------------------------------------------*/
-    optEntry *option_def;
-        /* Instructions to pm_optParseOptions3 on how to parse our options.
-         */
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -74,8 +72,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
-        /* Uses and sets argc, argv, and some of *cmdlineP and others. */
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
 
     if (!mapSpec)
         cmdlineP->map = NULL;
diff --git a/converter/other/pngtopam.c b/converter/other/pngtopam.c
index a700364f..acb04599 100644
--- a/converter/other/pngtopam.c
+++ b/converter/other/pngtopam.c
@@ -73,9 +73,7 @@ parseCommandLine(int                  argc,
    Note that the strings we return are stored in the storage that
    was passed to us as the argv array.  We also trash *argv.
 -----------------------------------------------------------------------------*/
-    optEntry * option_def;
-        /* Instructions to pm_optParseOptions3 on how to parse our options.
-         */
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -109,7 +107,7 @@ parseCommandLine(int                  argc,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
 
diff --git a/converter/other/pnmtojpeg.c b/converter/other/pnmtojpeg.c
index 99efa734..b80860e7 100644
--- a/converter/other/pnmtojpeg.c
+++ b/converter/other/pnmtojpeg.c
@@ -212,9 +212,7 @@ parseCommandLine(const int argc, const char ** argv,
    On the other hand, unlike other option processing functions, we do
    not change argv at all.
 -----------------------------------------------------------------------------*/
-    optEntry * option_def;
-        /* Instructions to OptParseOptions3 on how to parse our options.
-         */
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     int i;  /* local loop variable */
@@ -285,7 +283,7 @@ parseCommandLine(const int argc, const char ** argv,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argcParse, (char **)argvParse, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argcParse, argvParse, opt, sizeof(opt), 0);
 
     if (!qualitySpec)
         cmdlineP->quality = -1;  /* unspecified */
diff --git a/converter/other/pnmtopng.c b/converter/other/pnmtopng.c
index 08647045..10b586b0 100644
--- a/converter/other/pnmtopng.c
+++ b/converter/other/pnmtopng.c
@@ -284,9 +284,7 @@ parseCommandLine(int argc, const char ** argv,
    Note that the strings we return are stored in the storage that
    was passed to us as the argv array.  We also trash *argv.
 -----------------------------------------------------------------------------*/
-    optEntry *option_def;
-        /* Instructions to pm_optParseOptions3 on how to parse our options.
-         */
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -383,7 +381,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = false;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = false;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
 
diff --git a/converter/other/pnmtops.c b/converter/other/pnmtops.c
index d2577dd6..3dd0be79 100644
--- a/converter/other/pnmtops.c
+++ b/converter/other/pnmtops.c
@@ -264,7 +264,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = FALSE;
     opt.allowNegNum = FALSE;
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
 
     if (cmdlineP->mustturn && noturn)
         pm_error("You cannot specify both -turn and -noturn");
diff --git a/converter/other/pnmtorle.c b/converter/other/pnmtorle.c
index a75ab218..e8a37d9b 100644
--- a/converter/other/pnmtorle.c
+++ b/converter/other/pnmtorle.c
@@ -71,9 +71,7 @@ parseCommandLine(int argc, const char ** argv,
    Note that the file spec array we return is stored in the storage that
    was passed to us as the argv array.
 -----------------------------------------------------------------------------*/
-    optEntry * option_def;
-    /* Instructions to pm_optParseOptions3 on how to parse our options. */
-
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -92,7 +90,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = false;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = false;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     free(option_def);
diff --git a/converter/other/qoitopam.c b/converter/other/qoitopam.c
index 51dfd1e8..68182aa3 100644
--- a/converter/other/qoitopam.c
+++ b/converter/other/qoitopam.c
@@ -74,9 +74,7 @@ parseCommandLine(int                  argc,
    Note that the strings we return are stored in the storage that
    was passed to us as the argv array.  We also trash *argv.
 -----------------------------------------------------------------------------*/
-    optEntry * option_def;
-        /* Instructions to pm_optParseOptions3 on how to parse our options.
-         */
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -89,7 +87,7 @@ parseCommandLine(int                  argc,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (argc-1 < 1)
diff --git a/converter/other/rasttopnm.c b/converter/other/rasttopnm.c
index 7f6015a3..bc199ef7 100644
--- a/converter/other/rasttopnm.c
+++ b/converter/other/rasttopnm.c
@@ -37,9 +37,7 @@ parseCommandLine(int argc, const char ** argv,
    Note that the file spec array we return is stored in the storage that
    was passed to us as the argv array.
 -----------------------------------------------------------------------------*/
-    optEntry * option_def;
-        /* Instructions to OptParseOptions2 on how to parse our options.
-         */
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -59,7 +57,7 @@ parseCommandLine(int argc, const char ** argv,
     OPTENT3(0,   "dumpcolormap", OPT_FLAG,   NULL,
             &cmdlineP->dumpcolormap,   0);
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (argc-1 == 0)
diff --git a/converter/other/sgitopnm.c b/converter/other/sgitopnm.c
index 4bacc411..09bdc669 100644
--- a/converter/other/sgitopnm.c
+++ b/converter/other/sgitopnm.c
@@ -56,9 +56,7 @@ parseCommandLine(int argc, const char ** argv,
    Note that the strings we return are stored in the storage that
    was passed to us as the argv array.  We also trash *argv.
 -----------------------------------------------------------------------------*/
-    optEntry * option_def;
-        /* Instructions to pm_optParseOptions3 on how to parse our options.
-         */
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -78,7 +76,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     free(option_def);
diff --git a/converter/other/srftopam.c b/converter/other/srftopam.c
index 78d535fb..857d6d92 100644
--- a/converter/other/srftopam.c
+++ b/converter/other/srftopam.c
@@ -46,9 +46,7 @@ parseCommandLine(int argc, const char ** argv,
    Note that the strings we return are stored in the storage that
    was passed to us as the argv array.  We also trash *argv.
 -----------------------------------------------------------------------------*/
-    optEntry *option_def;
-    /* Instructions to pm_optParseOptions3 on how to parse our options.
-     */
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -63,7 +61,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
     /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (argc-1 < 1)
diff --git a/converter/other/tifftopnm.c b/converter/other/tifftopnm.c
index 44b3461b..0fbbaad0 100644
--- a/converter/other/tifftopnm.c
+++ b/converter/other/tifftopnm.c
@@ -105,8 +105,8 @@ parseCommandLine(int argc, const char ** const argv,
    sometimes, one of these strings is actually just a suffix of an entry
    in argv!
 -----------------------------------------------------------------------------*/
+    optEntry * option_def;
     optStruct3 opt;
-    optEntry *option_def;
     unsigned int option_def_index;
     unsigned int alphaSpec;
 
@@ -130,7 +130,7 @@ parseCommandLine(int argc, const char ** const argv,
     OPTENT3(0,   "alphaout",
             OPT_STRING, &cmdlineP->alphaFilename, &alphaSpec,  0);
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
 
     if (argc - 1 == 0)
         cmdlineP->inputFilename = strdup("-");  /* he wants stdin */
diff --git a/converter/other/winicontopam.c b/converter/other/winicontopam.c
index bb39bf60..b0dbbc07 100644
--- a/converter/other/winicontopam.c
+++ b/converter/other/winicontopam.c
@@ -86,7 +86,7 @@ parseCommandLine(int argc, const char **argv,
     opt3.short_allowed = false;
     opt3.allowNegNum   = false;
 
-    pm_optParseOptions3(&argc, (char **)argv, opt3, sizeof(opt3), 0);
+    pm_optParseOptions4(&argc, argv, opt3, sizeof(opt3), 0);
 
     if (cmdlineP->allimages && cmdlineP->imageSpec)
         pm_error("You cannot specify both -allimages and -image");
diff --git a/converter/other/xwdtopnm.c b/converter/other/xwdtopnm.c
index 810d302a..5f8a56c9 100644
--- a/converter/other/xwdtopnm.c
+++ b/converter/other/xwdtopnm.c
@@ -95,9 +95,7 @@ parseCommandLine(int argc, const char ** argv,
    sometimes, one of these strings is actually just a suffix of an entry
    in argv!
 -----------------------------------------------------------------------------*/
-    optEntry * option_def;
-        /* Instructions to OptParseOptions3 on how to parse our options.
-         */
+    optEntry * option_def;   /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int option_def_index;
@@ -115,7 +113,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We may have parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **) argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (argc - 1 == 0)
diff --git a/converter/other/yuy2topam.c b/converter/other/yuy2topam.c
index b4742bf5..8416d393 100644
--- a/converter/other/yuy2topam.c
+++ b/converter/other/yuy2topam.c
@@ -44,8 +44,7 @@ parseCommandLine(int argc, const char ** argv,
    Note that the strings we return are stored in the storage that
    was passed to us as the argv array.  We also trash *argv.
 --------------------------------------------------------------------------*/
-    optEntry * option_def;
-        /* Instructions to pm_optParseOptions3 on how to parse our options. */
+    optEntry * option_def; /* Used by OPTENT3 */
     optStruct3 opt;
 
     unsigned int widthSpec, heightSpec;
@@ -63,7 +62,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = false;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = false;   /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
         /* Uses and sets argc, argv, and some of *cmdlineP and others. */
 
     if (!widthSpec)