/[public]/getopt/trunk/getopt.c
ViewVC logotype

Diff of /getopt/trunk/getopt.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 327 Revision 359
197 if (opt == LONG_OPT) { 197 if (opt == LONG_OPT) {
198 printf(" --%s", longopts[longindex].name); 198 printf(" --%s", longopts[longindex].name);
199 if (longopts[longindex].has_arg) 199 if (longopts[longindex].has_arg)
200 printf(" %s", normalize(optarg ? optarg : "")); 200 printf(" %s", normalize(optarg ? optarg : ""));
201 } else if (opt == NON_OPT) 201 } else if (opt == NON_OPT)
202 printf(" %s", normalize(optarg)); 202 printf(" %s", normalize(optarg ? optarg : ""));
203 else { 203 else {
204 printf(" -%c", opt); 204 printf(" -%c", opt);
205 charptr = strchr(optstr, opt); 205 charptr = strchr(optstr, opt);
206 if (charptr != NULL && *++charptr == ':') 206 if (charptr != NULL && *++charptr == ':')
207 printf(" %s", normalize(optarg ? optarg : "")); 207 printf(" %s", normalize(optarg ? optarg : ""));
258 long_options[long_options_nr].name = NULL; 258 long_options[long_options_nr].name = NULL;
259 long_options[long_options_nr].has_arg = 0; 259 long_options[long_options_nr].has_arg = 0;
260 long_options[long_options_nr].flag = NULL; 260 long_options[long_options_nr].flag = NULL;
261 long_options[long_options_nr].val = 0; 261 long_options[long_options_nr].val = 0;
262 262
263 if (long_options_nr) { 263 if (long_options_nr && name) {
264 /* Not for init! */ 264 /* Not for init! */
265 long_options[long_options_nr - 1].has_arg = has_arg; 265 long_options[long_options_nr - 1].has_arg = has_arg;
266 long_options[long_options_nr - 1].flag = NULL; 266 long_options[long_options_nr - 1].flag = NULL;
267 long_options[long_options_nr - 1].val = LONG_OPT; 267 long_options[long_options_nr - 1].val = LONG_OPT;
268 tmp = xmalloc(strlen(name) + 1); 268 tmp = xmalloc(strlen(name) + 1);

Legend:
Removed from v.327  
changed lines
  Added in v.359

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26