1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
--- pnm/jpegtopnm.c.orig Sat Dec 16 17:19:20 2000
+++ pnm/jpegtopnm.c Sat Jan 13 00:00:00 2001
@@ -162,6 +162,15 @@
char ** const argv_parse = malloc(argc*sizeof(char *));
/* argv, except we modify it as we parse */
+ /* Create the OptStruct structure describing our options */
+ #define OPTENTRY(shortvalue,longvalue,typevalue,outputvalue,flagvalue) {\
+ option_def[option_def_index].shortName = (shortvalue); \
+ option_def[option_def_index].longName = (longvalue); \
+ option_def[option_def_index].type = (typevalue); \
+ option_def[option_def_index].arg = (outputvalue); \
+ option_def[option_def_index].flags = (flagvalue); \
+ option_def_index++; \
+ }
option_def_index = 0; /* incremented by OPTENTRY */
OPTENTRY(0, "verbose", OPT_FLAG, &cmdline_p->verbose, 0);
OPTENTRY(0, "dct", OPT_STRING, &dctval, 0);
@@ -171,6 +180,7 @@
OPTENTRY(0, "adobe", OPT_FLAG, &adobe, 0);
OPTENTRY(0, "notadobe", OPT_FLAG, ¬adobe, 0);
OPTENTRY(0, "comments", OPT_FLAG, &cmdline_p->comments, 0);
+ option_def[option_def_index].type = OPT_END;
/* Set the defaults */
cmdline_p->verbose = FALSE;
@@ -190,7 +200,7 @@
argc_parse = argc;
for (i=0; i < argc; i++) argv_parse[i] = argv[i];
- pm_optParseOptions2(&argc_parse, argv_parse, opt, 0);
+ optParseOptions2(&argc_parse, argv_parse, opt, 0);
/* Uses and sets argc_parse, argv_parse,
and some of *cmdline_p and others. */
|