diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-03-27 01:38:28 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2016-03-27 01:38:28 +0000 |
commit | 367c9cb514c9da766488b9bdb218a18e31cb7624 (patch) | |
tree | f9e343be94161a4837f0f1c1d072a35538ae0f63 /editor/pamdice.c | |
parent | 6e88e3326cb0c7f7975b56189278cab3f84ba1bd (diff) | |
download | netpbm-mirror-367c9cb514c9da766488b9bdb218a18e31cb7624.tar.gz netpbm-mirror-367c9cb514c9da766488b9bdb218a18e31cb7624.tar.xz netpbm-mirror-367c9cb514c9da766488b9bdb218a18e31cb7624.zip |
Promote Stable (10.47) to Super Stable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@2691 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor/pamdice.c')
-rw-r--r-- | editor/pamdice.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/editor/pamdice.c b/editor/pamdice.c index 062e05e3..f72420ab 100644 --- a/editor/pamdice.c +++ b/editor/pamdice.c @@ -11,6 +11,7 @@ #include <string.h> +#include "pm_c_util.h" #include "pam.h" #include "shhopt.h" #include "nstring.h" @@ -23,8 +24,8 @@ struct cmdlineInfo { /* All the information the user supplied in the command line, in a form easy for the program to use. */ - const char * inputFilespec; /* '-' if stdin */ - char * outstem; + const char * inputFileName; /* '-' if stdin */ + const char * outstem; /* null-terminated string, max MAXFILENAMELEN-10 characters */ unsigned int sliceVertically; /* boolean */ unsigned int sliceHorizontally; /* boolean */ @@ -39,8 +40,8 @@ struct cmdlineInfo { static void -parseCommandLine ( int argc, char ** argv, - struct cmdlineInfo * const cmdlineP ) { +parseCommandLine(int argc, char ** argv, + struct cmdlineInfo * const cmdlineP ) { /*---------------------------------------------------------------------------- parse program command line described in Unix standard form by argc and argv. Return the information in the options as *cmdlineP. @@ -63,17 +64,17 @@ parseCommandLine ( int argc, char ** argv, option_def_index = 0; /* incremented by OPTENT3 */ OPTENT3(0, "width", OPT_UINT, &cmdlineP->width, - &cmdlineP->sliceVertically, 0 ); + &cmdlineP->sliceVertically, 0); OPTENT3(0, "height", OPT_UINT, &cmdlineP->height, - &cmdlineP->sliceHorizontally, 0 ); + &cmdlineP->sliceHorizontally, 0); OPTENT3(0, "hoverlap", OPT_UINT, &cmdlineP->hoverlap, - &hoverlapSpec, 0 ); + &hoverlapSpec, 0); OPTENT3(0, "voverlap", OPT_UINT, &cmdlineP->voverlap, - &voverlapSpec, 0 ); + &voverlapSpec, 0); OPTENT3(0, "outstem", OPT_STRING, &cmdlineP->outstem, - &outstemSpec, 0 ); + &outstemSpec, 0); OPTENT3(0, "verbose", OPT_FLAG, NULL, - &cmdlineP->verbose, 0 ); + &cmdlineP->verbose, 0); opt.opt_table = option_def; opt.short_allowed = FALSE; /* We have no short (old-fashioned) options */ @@ -104,13 +105,14 @@ parseCommandLine ( int argc, char ** argv, if (!outstemSpec) pm_error("You must specify the -outstem option to indicate where to " "put the output images."); + if (argc-1 < 1) - cmdlineP->inputFilespec = "-"; + cmdlineP->inputFileName = "-"; else if (argc-1 == 1) - cmdlineP->inputFilespec = argv[1]; + cmdlineP->inputFileName = argv[1]; else pm_error("Progam takes at most 1 parameter: the file specification. " - "You specified %d", argc-1); + "You specified %u", argc-1); } @@ -451,7 +453,7 @@ main(int argc, char ** argv) { parseCommandLine(argc, argv, &cmdline); - ifP = pm_openr(cmdline.inputFilespec); + ifP = pm_openr(cmdline.inputFileName); pnm_readpaminit(ifP, &inpam, PAM_STRUCT_SIZE(tuple_type)); |