LibOFX: cmdline.c Source File

LibOFX

ofxdump/cmdline.c
1 /*
2 File autogenerated by gengetopt version 2.23
3 generated with the following command:
4 gengetopt --unamed-opts
5
6 The developers of gengetopt consider the fixed text that goes in all
7 gengetopt output files to be in the public domain:
8 we make no copyright claims on it.
9 */
10
11 /* If we use autoconf. */
12 #ifdef HAVE_CONFIG_H
13 #include "config.h"
14 #endif
15
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <string.h>
19
20 #ifndef FIX_UNUSED
21 #define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
22 #endif
23
24 #include <getopt.h>
25
26 #include "cmdline.h"
27
28 const char *gengetopt_args_info_purpose = "ofxdump prints to stdout, in human readable form, everything the library \nunderstands about a particular file or response, and sends errors to\nstderr. To know exactly what the library understands about of a particular\nofx response file, just call ofxdump on that file.";
29
30 const char *gengetopt_args_info_usage = "Usage: " CMDLINE_PARSER_PACKAGE " [OPTION]... [FILE]...";
31
32 const char *gengetopt_args_info_versiontext = "";
33
34 const char *gengetopt_args_info_description = "";
35
36 const char *gengetopt_args_info_help[] = {
37 " -h, --help Print help and exit",
38 " -V, --version Print version and exit",
39 " -f, --import-format=STRING Force the file format of the file(s) specified\n (default=`AUTODETECT')",
40 " --list-import-formats List available import file formats\n 'import-format' command",
41 " --msg_parser Output file parsing messages (default=off)",
42 " --msg_debug Output messages meant for debugging\n (default=off)",
43 " --msg_warning Output warning messages about abnormal conditions\n and unknown constructs (default=on)",
44 " --msg_error Output error messages (default=on)",
45 " --msg_info Output informational messages about the progress\n of the library (default=on)",
46 " --msg_status Output status messages (default=on)",
47 0
48 };
49
50 typedef enum {ARG_NO
51 , ARG_FLAG
52 , ARG_STRING
53 } cmdline_parser_arg_type;
54
55 static
56 void clear_given (struct gengetopt_args_info *args_info);
57 static
58 void clear_args (struct gengetopt_args_info *args_info);
59
60 static int
61 cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
62 struct cmdline_parser_params *params, const char *additional_error);
63
64
65 static char *
66 gengetopt_strdup (const char *s);
67
68 static
69 void clear_given (struct gengetopt_args_info *args_info)
70 {
71 args_info->help_given = 0 ;
72 args_info->version_given = 0 ;
73 args_info->import_format_given = 0 ;
74 args_info->list_import_formats_given = 0 ;
75 args_info->msg_parser_given = 0 ;
76 args_info->msg_debug_given = 0 ;
77 args_info->msg_warning_given = 0 ;
78 args_info->msg_error_given = 0 ;
79 args_info->msg_info_given = 0 ;
80 args_info->msg_status_given = 0 ;
81 }
82
83 static
84 void clear_args (struct gengetopt_args_info *args_info)
85 {
86 FIX_UNUSED (args_info);
87 args_info->import_format_arg = gengetopt_strdup ("AUTODETECT");
88 args_info->import_format_orig = NULL;
89 args_info->msg_parser_flag = 0;
90 args_info->msg_debug_flag = 0;
91 args_info->msg_warning_flag = 1;
92 args_info->msg_error_flag = 1;
93 args_info->msg_info_flag = 1;
94 args_info->msg_status_flag = 1;
95
96 }
97
98 static
99 void init_args_info(struct gengetopt_args_info *args_info)
100 {
101
102
103 args_info->help_help = gengetopt_args_info_help[0] ;
104 args_info->version_help = gengetopt_args_info_help[1] ;
105 args_info->import_format_help = gengetopt_args_info_help[2] ;
106 args_info->list_import_formats_help = gengetopt_args_info_help[3] ;
107 args_info->msg_parser_help = gengetopt_args_info_help[4] ;
108 args_info->msg_debug_help = gengetopt_args_info_help[5] ;
109 args_info->msg_warning_help = gengetopt_args_info_help[6] ;
110 args_info->msg_error_help = gengetopt_args_info_help[7] ;
111 args_info->msg_info_help = gengetopt_args_info_help[8] ;
112 args_info->msg_status_help = gengetopt_args_info_help[9] ;
113
114 }
115
116 void
117 cmdline_parser_print_version (void)
118 {
119 printf ("%s %s\n",
120 (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
121 CMDLINE_PARSER_VERSION);
122
123 if (strlen(gengetopt_args_info_versiontext) > 0)
124 printf("\n%s\n", gengetopt_args_info_versiontext);
125 }
126
127 static void print_help_common(void)
128 {
129 size_t len_purpose = strlen(gengetopt_args_info_purpose);
130 size_t len_usage = strlen(gengetopt_args_info_usage);
131
132 if (len_usage > 0) {
133 printf("%s\n", gengetopt_args_info_usage);
134 }
135 if (len_purpose > 0) {
136 printf("%s\n", gengetopt_args_info_purpose);
137 }
138
139 if (len_usage || len_purpose) {
140 printf("\n");
141 }
142
143 if (strlen(gengetopt_args_info_description) > 0) {
144 printf("%s\n\n", gengetopt_args_info_description);
145 }
146 }
147
148 void
149 cmdline_parser_print_help (void)
150 {
151 int i = 0;
152 print_help_common();
153 while (gengetopt_args_info_help[i])
154 printf("%s\n", gengetopt_args_info_help[i++]);
155 }
156
157 void
158 cmdline_parser_init (struct gengetopt_args_info *args_info)
159 {
160 clear_given (args_info);
161 clear_args (args_info);
162 init_args_info (args_info);
163
164 args_info->inputs = 0;
165 args_info->inputs_num = 0;
166 }
167
168 void
169 cmdline_parser_params_init(struct cmdline_parser_params *params)
170 {
171 if (params)
172 {
173 params->override = 0;
174 params->initialize = 1;
175 params->check_required = 1;
176 params->check_ambiguity = 0;
177 params->print_errors = 1;
178 }
179 }
180
181 struct cmdline_parser_params *
182 cmdline_parser_params_create(void)
183 {
184 struct cmdline_parser_params *params =
185 (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params));
186 cmdline_parser_params_init(params);
187 return params;
188 }
189
190 static void
191 free_string_field (char **s)
192 {
193 if (*s)
194 {
195 free (*s);
196 *s = 0;
197 }
198 }
199
200
201 static void
202 cmdline_parser_release (struct gengetopt_args_info *args_info)
203 {
204 unsigned int i;
205 free_string_field (&(args_info->import_format_arg));
206 free_string_field (&(args_info->import_format_orig));
207
208
209 for (i = 0; i < args_info->inputs_num; ++i)
210 free (args_info->inputs [i]);
211
212 if (args_info->inputs_num)
213 free (args_info->inputs);
214
215 clear_given (args_info);
216 }
217
218
219 static void
220 write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
221 {
222 FIX_UNUSED (values);
223 if (arg) {
224 fprintf(outfile, "%s=\"%s\"\n", opt, arg);
225 } else {
226 fprintf(outfile, "%s\n", opt);
227 }
228 }
229
230
231 int
232 cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
233 {
234 int i = 0;
235
236 if (!outfile)
237 {
238 fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE);
239 return EXIT_FAILURE;
240 }
241
242 if (args_info->help_given)
243 write_into_file(outfile, "help", 0, 0 );
244 if (args_info->version_given)
245 write_into_file(outfile, "version", 0, 0 );
246 if (args_info->import_format_given)
247 write_into_file(outfile, "import-format", args_info->import_format_orig, 0);
248 if (args_info->list_import_formats_given)
249 write_into_file(outfile, "list-import-formats", 0, 0 );
250 if (args_info->msg_parser_given)
251 write_into_file(outfile, "msg_parser", 0, 0 );
252 if (args_info->msg_debug_given)
253 write_into_file(outfile, "msg_debug", 0, 0 );
254 if (args_info->msg_warning_given)
255 write_into_file(outfile, "msg_warning", 0, 0 );
256 if (args_info->msg_error_given)
257 write_into_file(outfile, "msg_error", 0, 0 );
258 if (args_info->msg_info_given)
259 write_into_file(outfile, "msg_info", 0, 0 );
260 if (args_info->msg_status_given)
261 write_into_file(outfile, "msg_status", 0, 0 );
262
263
264 i = EXIT_SUCCESS;
265 return i;
266 }
267
268 int
269 cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info)
270 {
271 FILE *outfile;
272 int i = 0;
273
274 outfile = fopen(filename, "w");
275
276 if (!outfile)
277 {
278 fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename);
279 return EXIT_FAILURE;
280 }
281
282 i = cmdline_parser_dump(outfile, args_info);
283 fclose (outfile);
284
285 return i;
286 }
287
288 void
289 cmdline_parser_free (struct gengetopt_args_info *args_info)
290 {
291 cmdline_parser_release (args_info);
292 }
293
295 char *
296 gengetopt_strdup (const char *s)
297 {
298 char *result = 0;
299 if (!s)
300 return result;
301
302 result = (char*)malloc(strlen(s) + 1);
303 if (result == (char*)0)
304 return (char*)0;
305 strcpy(result, s);
306 return result;
307 }
308
309 int
310 cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
311 {
312 return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
313 }
314
315 int
316 cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
317 struct cmdline_parser_params *params)
318 {
319 int result;
320 result = cmdline_parser_internal (argc, argv, args_info, params, 0);
321
322 if (result == EXIT_FAILURE)
323 {
324 cmdline_parser_free (args_info);
325 exit (EXIT_FAILURE);
326 }
327
328 return result;
329 }
330
331 int
332 cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
333 {
334 int result;
335 struct cmdline_parser_params params;
336
337 params.override = override;
338 params.initialize = initialize;
339 params.check_required = check_required;
340 params.check_ambiguity = 0;
341 params.print_errors = 1;
342
343 result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
344
345 if (result == EXIT_FAILURE)
346 {
347 cmdline_parser_free (args_info);
348 exit (EXIT_FAILURE);
349 }
350
351 return result;
352 }
353
354 int
355 cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name)
356 {
357 FIX_UNUSED (args_info);
358 FIX_UNUSED (prog_name);
359 return EXIT_SUCCESS;
360 }
361
362
363 static char *package_name = 0;
364
383 static
384 int update_arg(void *field, char **orig_field,
385 unsigned int *field_given, unsigned int *prev_given,
386 char *value, const char *possible_values[],
387 const char *default_value,
388 cmdline_parser_arg_type arg_type,
389 int check_ambiguity, int override,
390 int no_free, int multiple_option,
391 const char *long_opt, char short_opt,
392 const char *additional_error)
393 {
394 char *stop_char = 0;
395 const char *val = value;
396 int found;
397 char **string_field;
398 FIX_UNUSED (field);
399
400 stop_char = 0;
401 found = 0;
402
403 if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given)))
404 {
405 if (short_opt != '-')
406 fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n",
407 package_name, long_opt, short_opt,
408 (additional_error ? additional_error : ""));
409 else
410 fprintf (stderr, "%s: `--%s' option given more than once%s\n",
411 package_name, long_opt,
412 (additional_error ? additional_error : ""));
413 return 1; /* failure */
414 }
415
416 FIX_UNUSED (default_value);
417
418 if (field_given && *field_given && ! override)
419 return 0;
420 if (prev_given)
421 (*prev_given)++;
422 if (field_given)
423 (*field_given)++;
424 if (possible_values)
425 val = possible_values[found];
426
427 switch(arg_type) {
428 case ARG_FLAG:
429 *((int *)field) = !*((int *)field);
430 break;
431 case ARG_STRING:
432 if (val) {
433 string_field = (char **)field;
434 if (!no_free && *string_field)
435 free (*string_field); /* free previous string */
436 *string_field = gengetopt_strdup (val);
437 }
438 break;
439 default:
440 break;
441 };
442
443 FIX_UNUSED(stop_char);
444
445 /* store the original value */
446 switch(arg_type) {
447 case ARG_NO:
448 case ARG_FLAG:
449 break;
450 default:
451 if (value && orig_field) {
452 if (no_free) {
453 *orig_field = value;
454 } else {
455 if (*orig_field)
456 free (*orig_field); /* free previous string */
457 *orig_field = gengetopt_strdup (value);
458 }
459 }
460 };
461
462 return 0; /* OK */
463 }
464
465
466 int
467 cmdline_parser_internal (
468 int argc, char **argv, struct gengetopt_args_info *args_info,
469 struct cmdline_parser_params *params, const char *additional_error)
470 {
471 int c; /* Character of the parsed option. */
472
473 int error_occurred = 0;
474 struct gengetopt_args_info local_args_info;
475
476 int override;
477 int initialize;
478 int check_required;
479 int check_ambiguity;
480
481 package_name = argv[0];
482
483 /* TODO: Why is this here? It is not used anywhere. */
484 override = params->override;
485 FIX_UNUSED(override);
486
487 initialize = params->initialize;
488 check_required = params->check_required;
489
490 /* TODO: Why is this here? It is not used anywhere. */
491 check_ambiguity = params->check_ambiguity;
492 FIX_UNUSED(check_ambiguity);
493
494 if (initialize)
495 cmdline_parser_init (args_info);
496
497 cmdline_parser_init (&local_args_info);
498
499 optarg = 0;
500 optind = 0;
501 opterr = params->print_errors;
502 optopt = '?';
503
504 while (1)
505 {
506 int option_index = 0;
507
508 static struct option long_options[] = {
509 { "help", 0, NULL, 'h' },
510 { "version", 0, NULL, 'V' },
511 { "import-format", 1, NULL, 'f' },
512 { "list-import-formats", 0, NULL, 0 },
513 { "msg_parser", 0, NULL, 0 },
514 { "msg_debug", 0, NULL, 0 },
515 { "msg_warning", 0, NULL, 0 },
516 { "msg_error", 0, NULL, 0 },
517 { "msg_info", 0, NULL, 0 },
518 { "msg_status", 0, NULL, 0 },
519 { 0, 0, 0, 0 }
520 };
521
522 c = getopt_long (argc, argv, "hVf:", long_options, &option_index);
523
524 if (c == -1) break; /* Exit from `while (1)' loop. */
525
526 switch (c)
527 {
528 case 'h': /* Print help and exit. */
529 cmdline_parser_print_help ();
530 cmdline_parser_free (&local_args_info);
531 exit (EXIT_SUCCESS);
532
533 case 'V': /* Print version and exit. */
534 cmdline_parser_print_version ();
535 cmdline_parser_free (&local_args_info);
536 exit (EXIT_SUCCESS);
537
538 case 'f': /* Force the file format of the file(s) specified. */
539
540
541 if (update_arg( (void *)&(args_info->import_format_arg),
542 &(args_info->import_format_orig), &(args_info->import_format_given),
543 &(local_args_info.import_format_given), optarg, 0, "AUTODETECT", ARG_STRING,
544 check_ambiguity, override, 0, 0,
545 "import-format", 'f',
546 additional_error))
547 goto failure;
548
549 break;
550
551 case 0: /* Long option with no short option */
552 /* List available import file formats 'import-format' command. */
553 if (strcmp (long_options[option_index].name, "list-import-formats") == 0)
554 {
555
556
557 if (update_arg( 0 ,
558 0 , &(args_info->list_import_formats_given),
559 &(local_args_info.list_import_formats_given), optarg, 0, 0, ARG_NO,
560 check_ambiguity, override, 0, 0,
561 "list-import-formats", '-',
562 additional_error))
563 goto failure;
564
565 }
566 /* Output file parsing messages. */
567 else if (strcmp (long_options[option_index].name, "msg_parser") == 0)
568 {
569
570
571 if (update_arg((void *)&(args_info->msg_parser_flag), 0, &(args_info->msg_parser_given),
572 &(local_args_info.msg_parser_given), optarg, 0, 0, ARG_FLAG,
573 check_ambiguity, override, 1, 0, "msg_parser", '-',
574 additional_error))
575 goto failure;
576
577 }
578 /* Output messages meant for debugging. */
579 else if (strcmp (long_options[option_index].name, "msg_debug") == 0)
580 {
581
582
583 if (update_arg((void *)&(args_info->msg_debug_flag), 0, &(args_info->msg_debug_given),
584 &(local_args_info.msg_debug_given), optarg, 0, 0, ARG_FLAG,
585 check_ambiguity, override, 1, 0, "msg_debug", '-',
586 additional_error))
587 goto failure;
588
589 }
590 /* Output warning messages about abnormal conditions and unknown constructs. */
591 else if (strcmp (long_options[option_index].name, "msg_warning") == 0)
592 {
593
594
595 if (update_arg((void *)&(args_info->msg_warning_flag), 0, &(args_info->msg_warning_given),
596 &(local_args_info.msg_warning_given), optarg, 0, 0, ARG_FLAG,
597 check_ambiguity, override, 1, 0, "msg_warning", '-',
598 additional_error))
599 goto failure;
600
601 }
602 /* Output error messages. */
603 else if (strcmp (long_options[option_index].name, "msg_error") == 0)
604 {
605
606
607 if (update_arg((void *)&(args_info->msg_error_flag), 0, &(args_info->msg_error_given),
608 &(local_args_info.msg_error_given), optarg, 0, 0, ARG_FLAG,
609 check_ambiguity, override, 1, 0, "msg_error", '-',
610 additional_error))
611 goto failure;
612
613 }
614 /* Output informational messages about the progress of the library. */
615 else if (strcmp (long_options[option_index].name, "msg_info") == 0)
616 {
617
618
619 if (update_arg((void *)&(args_info->msg_info_flag), 0, &(args_info->msg_info_given),
620 &(local_args_info.msg_info_given), optarg, 0, 0, ARG_FLAG,
621 check_ambiguity, override, 1, 0, "msg_info", '-',
622 additional_error))
623 goto failure;
624
625 }
626 /* Output status messages. */
627 else if (strcmp (long_options[option_index].name, "msg_status") == 0)
628 {
629
630
631 if (update_arg((void *)&(args_info->msg_status_flag), 0, &(args_info->msg_status_given),
632 &(local_args_info.msg_status_given), optarg, 0, 0, ARG_FLAG,
633 check_ambiguity, override, 1, 0, "msg_status", '-',
634 additional_error))
635 goto failure;
636
637 }
638
639 break;
640 case '?': /* Invalid option. */
641 /* `getopt_long' already printed an error message. */
642 goto failure;
643
644 default: /* bug: option not considered. */
645 fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : ""));
646 abort ();
647 } /* switch */
648 } /* while */
649
650
651
652 FIX_UNUSED(check_required);
653
654 cmdline_parser_release (&local_args_info);
655
656 if ( error_occurred )
657 return (EXIT_FAILURE);
658
659 if (optind < argc)
660 {
661 int i = 0 ;
662 int found_prog_name = 0;
663 /* whether program name, i.e., argv[0], is in the remaining args
664 (this may happen with some implementations of getopt,
665 but surely not with the one included by gengetopt) */
666
667 i = optind;
668 while (i < argc)
669 if (argv[i++] == argv[0]) {
670 found_prog_name = 1;
671 break;
672 }
673 i = 0;
674
675 args_info->inputs_num = argc - optind - found_prog_name;
676 args_info->inputs =
677 (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
678 while (optind < argc)
679 if (argv[optind++] != argv[0])
680 args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ;
681 }
682
683 return 0;
684
685 failure:
686
687 cmdline_parser_release (&local_args_info);
688 return (EXIT_FAILURE);
689 }
690 /* vim: set ft=c noet ts=8 sts=8 sw=8 tw=80 nojs spell : */
gengetopt_args_info::msg_parser_flag
int msg_parser_flag
Output file parsing messages (default=off).
Definition: ofxdump/cmdline.h:50
gengetopt_args_info::help_given
unsigned int help_given
Whether help was given.
Definition: ofxconnect/cmdline.h:91
gengetopt_args_info::msg_info_given
unsigned int msg_info_given
Whether msg_info was given.
Definition: ofxdump/cmdline.h:71
gengetopt_args_info::msg_status_help
const char * msg_status_help
Output status messages help description.
Definition: ofxdump/cmdline.h:61
gengetopt_args_info::import_format_arg
char * import_format_arg
Force the file format of the file(s) specified (default='AUTODETECT').
Definition: ofxdump/cmdline.h:46
gengetopt_args_info_purpose
const char * gengetopt_args_info_purpose
the purpose string of the program
Definition: ofxconnect/cmdline.c:28
cmdline_parser_params_init
void cmdline_parser_params_init(struct cmdline_parser_params *params)
Definition: ofxconnect/cmdline.c:221
CMDLINE_PARSER_PACKAGE
#define CMDLINE_PARSER_PACKAGE
the program name (used for printing errors)
Definition: ofxconnect/cmdline.h:24
gengetopt_args_info::msg_warning_help
const char * msg_warning_help
Output warning messages about abnormal conditions and unknown constructs help description.
Definition: ofxdump/cmdline.h:55
gengetopt_args_info::msg_parser_given
unsigned int msg_parser_given
Whether msg_parser was given.
Definition: ofxdump/cmdline.h:67
gengetopt_args_info::msg_status_given
unsigned int msg_status_given
Whether msg_status was given.
Definition: ofxdump/cmdline.h:72
gengetopt_args_info::inputs
char ** inputs
unnamed options (options without names)
Definition: ofxconnect/cmdline.h:114
cmdline_parser_file_save
int cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info)
Definition: ofxconnect/cmdline.c:364
cmdline.h
The header file for the command line option parser generated by GNU Gengetopt version 2....
gengetopt_args_info::msg_error_flag
int msg_error_flag
Output error messages (default=on).
Definition: ofxdump/cmdline.h:56
gengetopt_args_info::msg_debug_given
unsigned int msg_debug_given
Whether msg_debug was given.
Definition: ofxdump/cmdline.h:68
gengetopt_args_info::msg_debug_flag
int msg_debug_flag
Output messages meant for debugging (default=off).
Definition: ofxdump/cmdline.h:52
gengetopt_args_info::list_import_formats_given
unsigned int list_import_formats_given
Whether list-import-formats was given.
Definition: ofxdump/cmdline.h:66
cmdline_parser_print_help
void cmdline_parser_print_help(void)
Definition: ofxconnect/cmdline.c:201
gengetopt_args_info::version_given
unsigned int version_given
Whether version was given.
Definition: ofxconnect/cmdline.h:92
gengetopt_args_info::msg_warning_given
unsigned int msg_warning_given
Whether msg_warning was given.
Definition: ofxdump/cmdline.h:69
CMDLINE_PARSER_PACKAGE_NAME
#define CMDLINE_PARSER_PACKAGE_NAME
the complete program name (used for help and version)
Definition: ofxconnect/cmdline.h:32
cmdline_parser_dump
int cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
Definition: ofxconnect/cmdline.c:303
gengetopt_args_info::msg_debug_help
const char * msg_debug_help
Output messages meant for debugging help description.
Definition: ofxdump/cmdline.h:53
cmdline_parser_free
void cmdline_parser_free(struct gengetopt_args_info *args_info)
Definition: ofxconnect/cmdline.c:384
gengetopt_args_info::import_format_help
const char * import_format_help
Force the file format of the file(s) specified help description.
Definition: ofxdump/cmdline.h:48
cmdline_parser_print_version
void cmdline_parser_print_version(void)
Definition: ofxconnect/cmdline.c:169
gengetopt_args_info::list_import_formats_help
const char * list_import_formats_help
List available import file formats 'import-format' command help description.
Definition: ofxdump/cmdline.h:49
gengetopt_args_info::import_format_given
unsigned int import_format_given
Whether import-format was given.
Definition: ofxdump/cmdline.h:65
gengetopt_args_info::version_help
const char * version_help
Print version and exit help description.
Definition: ofxconnect/cmdline.h:45
cmdline_parser_params::override
int override
whether to override possibly already present options (default 0)
Definition: ofxconnect/cmdline.h:122
gengetopt_args_info::msg_parser_help
const char * msg_parser_help
Output file parsing messages help description.
Definition: ofxdump/cmdline.h:51
CMDLINE_PARSER_VERSION
#define CMDLINE_PARSER_VERSION
the program version
Definition: ofxconnect/cmdline.h:38
gengetopt_args_info::msg_error_help
const char * msg_error_help
Output error messages help description.
Definition: ofxdump/cmdline.h:57
cmdline_parser_params::check_ambiguity
int check_ambiguity
whether to check for options already specified in the option structure gengetopt_args_info (default 0...
Definition: ofxconnect/cmdline.h:125
gengetopt_args_info::import_format_orig
char * import_format_orig
Force the file format of the file(s) specified original value given at command line.
Definition: ofxdump/cmdline.h:47
cmdline_parser_params_create
struct cmdline_parser_params * cmdline_parser_params_create(void)
Definition: ofxconnect/cmdline.c:234
gengetopt_args_info::msg_status_flag
int msg_status_flag
Output status messages (default=on).
Definition: ofxdump/cmdline.h:60
cmdline_parser_params::print_errors
int print_errors
whether getopt_long should print an error message for a bad option (default 1)
Definition: ofxconnect/cmdline.h:126
gengetopt_args_info_usage
const char * gengetopt_args_info_usage
the usage string of the program
Definition: ofxconnect/cmdline.c:30
gengetopt_args_info::inputs_num
unsigned inputs_num
unnamed options number
Definition: ofxconnect/cmdline.h:115
cmdline_parser
int cmdline_parser(int argc, char **argv, struct gengetopt_args_info *args_info)
Definition: ofxconnect/cmdline.c:423
gengetopt_args_info_help
const char * gengetopt_args_info_help[]
all the lines making the help output
Definition: ofxconnect/cmdline.c:36
gengetopt_args_info::msg_warning_flag
int msg_warning_flag
Output warning messages about abnormal conditions and unknown constructs (default=on).
Definition: ofxdump/cmdline.h:54
cmdline_parser_required
int cmdline_parser_required(struct gengetopt_args_info *args_info, const char *prog_name)
Definition: ofxconnect/cmdline.c:468
gengetopt_args_info
Where the command line options are stored.
Definition: ofxconnect/cmdline.h:42
cmdline_parser_params
The additional parameters to pass to parser functions.
Definition: ofxconnect/cmdline.h:120
cmdline_parser2
int cmdline_parser2(int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
Definition: ofxconnect/cmdline.c:445
gengetopt_args_info::msg_info_help
const char * msg_info_help
Output informational messages about the progress of the library help description.
Definition: ofxdump/cmdline.h:59
gengetopt_args_info::help_help
const char * help_help
Print help and exit help description.
Definition: ofxconnect/cmdline.h:44
cmdline_parser_params::initialize
int initialize
whether to initialize the option structure gengetopt_args_info (default 1)
Definition: ofxconnect/cmdline.h:123
gengetopt_args_info::msg_info_flag
int msg_info_flag
Output informational messages about the progress of the library (default=on).
Definition: ofxdump/cmdline.h:58
cmdline_parser_params::check_required
int check_required
whether to check that all required options were provided (default 1)
Definition: ofxconnect/cmdline.h:124
cmdline_parser_init
void cmdline_parser_init(struct gengetopt_args_info *args_info)
Definition: ofxconnect/cmdline.c:210
gengetopt_args_info_description
const char * gengetopt_args_info_description
the description string of the program
Definition: ofxconnect/cmdline.c:34
cmdline_parser_ext
int cmdline_parser_ext(int argc, char **argv, struct gengetopt_args_info *args_info, struct cmdline_parser_params *params)
Definition: ofxconnect/cmdline.c:429
gengetopt_args_info::msg_error_given
unsigned int msg_error_given
Whether msg_error was given.
Definition: ofxdump/cmdline.h:70