about summary refs log tree commit diff
path: root/lib/util/shhopt.h
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-06-30 03:27:10 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-06-30 03:27:10 +0000
commit08d938dc6fc6b30e5da6733b52c97169c0d24f8a (patch)
tree92673cd6a5755fc209078cc6b6a42602defc0212 /lib/util/shhopt.h
parente21f4e95d897c93a4779bf78c71f1341d164a222 (diff)
downloadnetpbm-mirror-08d938dc6fc6b30e5da6733b52c97169c0d24f8a.tar.gz
netpbm-mirror-08d938dc6fc6b30e5da6733b52c97169c0d24f8a.tar.xz
netpbm-mirror-08d938dc6fc6b30e5da6733b52c97169c0d24f8a.zip
Copy Development as new Advanced
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@3018 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib/util/shhopt.h')
-rw-r--r--lib/util/shhopt.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/lib/util/shhopt.h b/lib/util/shhopt.h
index 6b56bfd4..5effa5fd 100644
--- a/lib/util/shhopt.h
+++ b/lib/util/shhopt.h
@@ -18,6 +18,7 @@ main ( int argc, char **argv ) {
     int height=7;
     int verbose_flag=7;
     int debug_flag=7;
+    char ** methodlist;
     struct optNameValue * optlist;
     
     optStruct3 opt;
@@ -25,12 +26,13 @@ main ( int argc, char **argv ) {
     optEntry * option_def;
     MALLOCARRAY(option_def, 100);
 
-    OPTENT3(0,   "help",     OPT_FLAG,     &help_flag,    &help_spec,   0);
-    OPTENT3(0,   "height",   OPT_INT,      &height,       &height_spec, 0);
-    OPTENT3('n', "name",     OPT_STRING,   &name,         &name_spec,   0);
-    OPTENT3('v', "verbose",  OPT_FLAG,     &verbose_flag, NULL,         0);
-    OPTENT3('g', "debug",    OPT_FLAG,     &debug_flag,   NULL,         0);
-    OPTENT3(0,   "options",  OPT_NAMELIST, &optlist,      NULL,         0);
+    OPTENT3(0,   "help",     OPT_FLAG,       &help_flag,    &help_spec,   0);
+    OPTENT3(0,   "height",   OPT_INT,        &height,       &height_spec, 0);
+    OPTENT3('n', "name",     OPT_STRING,     &name,         &name_spec,   0);
+    OPTENT3('v', "verbose",  OPT_FLAG,       &verbose_flag, NULL,         0);
+    OPTENT3('g', "debug",    OPT_FLAG,       &debug_flag,   NULL,         0);
+    OPTENT3(0,   "methods",  OPT_STRINGLIST, &methodlist,   NULL,         0);
+    OPTENT3(0,   "options",  OPT_NAMELIST,   &optlist,      NULL,         0);
 
     opt.opt_table = option_def;
     opt.short_allowed = 1;
@@ -50,13 +52,24 @@ main ( int argc, char **argv ) {
     printf("verbose_flag=%d\n", verbose_flag);
     printf("debug_flag=%d\n", verbose_flag);
 
+    if (methodlist) {
+        unsigned int i;
+        printf("methods: ");
+        while (methodlist[i]) {
+            printf("'%s', ", methodlist[i]);
+            ++i;
+        }
+        free(methodlist);
+    } else
+        printf("No -options\n");
+
     if (optlist) {
         unsigned int i;
         while (optlist[i].name) {
             printf("option '%s' = '%s'\n", optlist[i].name, optlist[i].value);
             ++i;
         }
-        optDestroyNameValueList(optlist);
+        pm_optDestroyNameValueList(optlist);
     } else
         printf("No -options\n");
 }