2
File autogenerated by gengetopt
3
generated with the following command:
4
../src/gengetopt --gen-version --input=test_modes_cmd.ggo --func-name=test_modes_cmd_parser --file-name=test_modes_cmd --unamed-opt --show-required
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.
11
/* If we use autoconf. */
22
#include "test_modes_cmd.h"
24
const char *gengetopt_args_info_purpose = "";
26
const char *gengetopt_args_info_usage = "Usage: test_modes [OPTIONS]... [FILES]...";
28
const char *gengetopt_args_info_description = "";
30
const char *gengetopt_args_info_help[] = {
31
" -h, --help Print help and exit",
32
" -V, --version Print version and exit",
33
"\nsome non mode options:",
34
" -N, --no-mode a generic option not beloging to any mode",
35
" --no-mode2=STRING another generic option not beloging to any mode",
36
"\nsome modes just for testing:",
37
"\n Mode: mode1\n any option of this mode is in contrast with any option of the other mode\n Notice that this description is quite long so it may spawn many lines... \n fortunately gengetopt will wrap it for you :-)",
38
" -a, --opta string a",
39
" -A, --optA[=STRING] string A (mandatory)",
40
" -M, --optAmul[=STRING] string M",
41
" -b, --optb string b",
44
" -d, --optd string d (mandatory)",
46
" -m, --mopt=INT option of my mode",
53
} test_modes_cmd_parser_arg_type;
56
void clear_given (struct gengetopt_args_info *args_info);
58
void clear_args (struct gengetopt_args_info *args_info);
61
test_modes_cmd_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
62
struct test_modes_cmd_parser_params *params, const char *additional_error);
65
test_modes_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error);
68
gengetopt_strdup (const char *s);
71
void clear_given (struct gengetopt_args_info *args_info)
73
args_info->help_given = 0 ;
74
args_info->version_given = 0 ;
75
args_info->no_mode_given = 0 ;
76
args_info->no_mode2_given = 0 ;
77
args_info->opta_given = 0 ;
78
args_info->optA_given = 0 ;
79
args_info->optAmul_given = 0 ;
80
args_info->optb_given = 0 ;
81
args_info->optc_given = 0 ;
82
args_info->optd_given = 0 ;
83
args_info->mopt_given = 0 ;
84
args_info->mode_2_mode_counter = 0 ;
85
args_info->mode1_mode_counter = 0 ;
86
args_info->my_mode_mode_counter = 0 ;
90
void clear_args (struct gengetopt_args_info *args_info)
92
args_info->no_mode2_arg = NULL;
93
args_info->no_mode2_orig = NULL;
94
args_info->optA_arg = NULL;
95
args_info->optA_orig = NULL;
96
args_info->optAmul_arg = NULL;
97
args_info->optAmul_orig = NULL;
98
args_info->mopt_orig = NULL;
103
void init_args_info(struct gengetopt_args_info *args_info)
107
args_info->help_help = gengetopt_args_info_help[0] ;
108
args_info->version_help = gengetopt_args_info_help[1] ;
109
args_info->no_mode_help = gengetopt_args_info_help[3] ;
110
args_info->no_mode2_help = gengetopt_args_info_help[4] ;
111
args_info->opta_help = gengetopt_args_info_help[7] ;
112
args_info->opta_min = -1;
113
args_info->opta_max = -1;
114
args_info->optA_help = gengetopt_args_info_help[8] ;
115
args_info->optAmul_help = gengetopt_args_info_help[9] ;
116
args_info->optAmul_min = -1;
117
args_info->optAmul_max = -1;
118
args_info->optb_help = gengetopt_args_info_help[10] ;
119
args_info->optc_help = gengetopt_args_info_help[12] ;
120
args_info->optd_help = gengetopt_args_info_help[13] ;
121
args_info->mopt_help = gengetopt_args_info_help[15] ;
126
test_modes_cmd_parser_print_version (void)
128
printf ("%s %s\n", TEST_MODES_CMD_PARSER_PACKAGE, TEST_MODES_CMD_PARSER_VERSION);
131
static void print_help_common(void) {
132
test_modes_cmd_parser_print_version ();
134
if (strlen(gengetopt_args_info_purpose) > 0)
135
printf("\n%s\n", gengetopt_args_info_purpose);
137
if (strlen(gengetopt_args_info_usage) > 0)
138
printf("\n%s\n", gengetopt_args_info_usage);
142
if (strlen(gengetopt_args_info_description) > 0)
143
printf("%s\n", gengetopt_args_info_description);
147
test_modes_cmd_parser_print_help (void)
151
while (gengetopt_args_info_help[i])
152
printf("%s\n", gengetopt_args_info_help[i++]);
156
test_modes_cmd_parser_init (struct gengetopt_args_info *args_info)
158
clear_given (args_info);
159
clear_args (args_info);
160
init_args_info (args_info);
162
args_info->inputs = NULL;
163
args_info->inputs_num = 0;
167
test_modes_cmd_parser_params_init(struct test_modes_cmd_parser_params *params)
171
params->override = 0;
172
params->initialize = 1;
173
params->check_required = 1;
174
params->check_ambiguity = 0;
175
params->print_errors = 1;
179
struct test_modes_cmd_parser_params *
180
test_modes_cmd_parser_params_create(void)
182
struct test_modes_cmd_parser_params *params =
183
(struct test_modes_cmd_parser_params *)malloc(sizeof(struct test_modes_cmd_parser_params));
184
test_modes_cmd_parser_params_init(params);
189
free_string_field (char **s)
198
/** @brief generic value variable */
199
union generic_value {
204
/** @brief holds temporary values for multiple options */
207
union generic_value arg;
209
struct generic_list *next;
213
* @brief add a node at the head of the list
215
static void add_node(struct generic_list **list) {
216
struct generic_list *new_node = (struct generic_list *) malloc (sizeof (struct generic_list));
217
new_node->next = *list;
219
new_node->arg.string_arg = NULL;
220
new_node->orig = NULL;
225
free_multiple_string_field(unsigned int len, char ***arg, char ***orig)
229
for (i = 0; i < len; ++i)
231
free_string_field(&((*arg)[i]));
232
free_string_field(&((*orig)[i]));
234
free_string_field(&((*arg)[0])); /* free default string */
244
test_modes_cmd_parser_release (struct gengetopt_args_info *args_info)
247
free_string_field (&(args_info->no_mode2_arg));
248
free_string_field (&(args_info->no_mode2_orig));
249
free_string_field (&(args_info->optA_arg));
250
free_string_field (&(args_info->optA_orig));
251
free_multiple_string_field (args_info->optAmul_given, &(args_info->optAmul_arg), &(args_info->optAmul_orig));
252
free_string_field (&(args_info->mopt_orig));
255
for (i = 0; i < args_info->inputs_num; ++i)
256
free (args_info->inputs [i]);
258
if (args_info->inputs_num)
259
free (args_info->inputs);
261
clear_given (args_info);
266
write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[])
269
fprintf(outfile, "%s=\"%s\"\n", opt, arg);
271
fprintf(outfile, "%s\n", opt);
276
write_multiple_into_file(FILE *outfile, int len, const char *opt, char **arg, char *values[])
280
for (i = 0; i < len; ++i)
281
write_into_file(outfile, opt, (arg ? arg[i] : 0), values);
285
test_modes_cmd_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
291
fprintf (stderr, "%s: cannot dump options to stream\n", TEST_MODES_CMD_PARSER_PACKAGE);
295
if (args_info->help_given)
296
write_into_file(outfile, "help", 0, 0 );
297
if (args_info->version_given)
298
write_into_file(outfile, "version", 0, 0 );
299
if (args_info->no_mode_given)
300
write_into_file(outfile, "no-mode", 0, 0 );
301
if (args_info->no_mode2_given)
302
write_into_file(outfile, "no-mode2", args_info->no_mode2_orig, 0);
303
write_multiple_into_file(outfile, args_info->opta_given, "opta", 0, 0);
304
if (args_info->optA_given)
305
write_into_file(outfile, "optA", args_info->optA_orig, 0);
306
write_multiple_into_file(outfile, args_info->optAmul_given, "optAmul", args_info->optAmul_orig, 0);
307
if (args_info->optb_given)
308
write_into_file(outfile, "optb", 0, 0 );
309
if (args_info->optc_given)
310
write_into_file(outfile, "optc", 0, 0 );
311
if (args_info->optd_given)
312
write_into_file(outfile, "optd", 0, 0 );
313
if (args_info->mopt_given)
314
write_into_file(outfile, "mopt", args_info->mopt_orig, 0);
322
test_modes_cmd_parser_file_save(const char *filename, struct gengetopt_args_info *args_info)
327
outfile = fopen(filename, "w");
331
fprintf (stderr, "%s: cannot open file for writing: %s\n", TEST_MODES_CMD_PARSER_PACKAGE, filename);
335
i = test_modes_cmd_parser_dump(outfile, args_info);
342
test_modes_cmd_parser_free (struct gengetopt_args_info *args_info)
344
test_modes_cmd_parser_release (args_info);
347
/** @brief replacement of strdup, which is not standard */
349
gengetopt_strdup (const char *s)
355
result = (char*)malloc(strlen(s) + 1);
356
if (result == (char*)0)
363
get_multiple_arg_token(const char *arg)
366
size_t len, num_of_escape;
372
tok = strchr (arg, ',');
375
/* make sure it is not escaped */
378
if (*(tok-1) == '\\')
380
/* find the next one */
381
tok = strchr (tok+1, ',');
389
len = (size_t)(tok - arg + 1);
391
len = strlen (arg) + 1;
393
len -= num_of_escape;
395
ret = (char *) malloc (len);
399
while (arg[i] && (j < len-1))
401
if (arg[i] == '\\' &&
415
get_multiple_arg_token_next(const char *arg)
422
tok = strchr (arg, ',');
424
/* make sure it is not escaped */
427
if (*(tok-1) == '\\')
429
/* find the next one */
430
tok = strchr (tok+1, ',');
436
if (! tok || strlen(tok) == 1)
443
check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, int min, int max, const char *option_desc);
446
check_multiple_option_occurrences(const char *prog_name, unsigned int option_given, int min, int max, const char *option_desc)
450
if (option_given && ! (min < 0 && max < 0))
452
if (min >= 0 && max >= 0)
456
/* specific occurrences */
457
if (option_given != min)
459
fprintf (stderr, "%s: %s option occurrences must be %d\n",
460
prog_name, option_desc, min);
464
else if (option_given < min
465
|| option_given > max)
467
/* range occurrences */
468
fprintf (stderr, "%s: %s option occurrences must be between %d and %d\n",
469
prog_name, option_desc, min, max);
476
if (option_given < min)
478
fprintf (stderr, "%s: %s option occurrences must be at least %d\n",
479
prog_name, option_desc, min);
486
if (option_given > max)
488
fprintf (stderr, "%s: %s option occurrences must be at most %d\n",
489
prog_name, option_desc, max);
498
test_modes_cmd_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
500
return test_modes_cmd_parser2 (argc, argv, args_info, 0, 1, 1);
504
test_modes_cmd_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info,
505
struct test_modes_cmd_parser_params *params)
508
result = test_modes_cmd_parser_internal (argc, argv, args_info, params, NULL);
510
if (result == EXIT_FAILURE)
512
test_modes_cmd_parser_free (args_info);
520
test_modes_cmd_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
523
struct test_modes_cmd_parser_params params;
525
params.override = override;
526
params.initialize = initialize;
527
params.check_required = check_required;
528
params.check_ambiguity = 0;
529
params.print_errors = 1;
531
result = test_modes_cmd_parser_internal (argc, argv, args_info, ¶ms, NULL);
533
if (result == EXIT_FAILURE)
535
test_modes_cmd_parser_free (args_info);
543
test_modes_cmd_parser_required (struct gengetopt_args_info *args_info, const char *prog_name)
545
int result = EXIT_SUCCESS;
547
if (test_modes_cmd_parser_required2(args_info, prog_name, NULL) > 0)
548
result = EXIT_FAILURE;
550
if (result == EXIT_FAILURE)
552
test_modes_cmd_parser_free (args_info);
560
test_modes_cmd_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
564
/* checks for required options */
565
if (args_info->mode1_mode_counter && check_multiple_option_occurrences(prog_name, args_info->opta_given, args_info->opta_min, args_info->opta_max, "'--opta' ('-a')"))
568
if (args_info->mode1_mode_counter && ! args_info->optA_given)
570
fprintf (stderr, "%s: '--optA' ('-A') option required%s\n", prog_name, (additional_error ? additional_error : ""));
574
if (args_info->mode1_mode_counter && check_multiple_option_occurrences(prog_name, args_info->optAmul_given, args_info->optAmul_min, args_info->optAmul_max, "'--optAmul' ('-M')"))
577
if (args_info->mode_2_mode_counter && ! args_info->optd_given)
579
fprintf (stderr, "%s: '--optd' ('-d') option required%s\n", prog_name, (additional_error ? additional_error : ""));
584
/* checks for dependences among options */
590
static char *package_name = 0;
593
* @brief updates an option
594
* @param field the generic pointer to the field to update
595
* @param orig_field the pointer to the orig field
596
* @param field_given the pointer to the number of occurrence of this option
597
* @param prev_given the pointer to the number of occurrence already seen
598
* @param value the argument for this option (if null no arg was specified)
599
* @param possible_values the possible values for this option (if specified)
600
* @param default_value the default value (in case the option only accepts fixed values)
601
* @param arg_type the type of this option
602
* @param check_ambiguity @see test_modes_cmd_parser_params.check_ambiguity
603
* @param override @see test_modes_cmd_parser_params.override
604
* @param no_free whether to free a possible previous value
605
* @param multiple_option whether this is a multiple option
606
* @param long_opt the corresponding long option
607
* @param short_opt the corresponding short option (or '-' if none)
608
* @param additional_error possible further error specification
611
int update_arg(void *field, char **orig_field,
612
unsigned int *field_given, unsigned int *prev_given,
613
char *value, char *possible_values[], const char *default_value,
614
test_modes_cmd_parser_arg_type arg_type,
615
int check_ambiguity, int override,
616
int no_free, int multiple_option,
617
const char *long_opt, char short_opt,
618
const char *additional_error)
621
const char *val = value;
628
if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given)))
630
if (short_opt != '-')
631
fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n",
632
package_name, long_opt, short_opt,
633
(additional_error ? additional_error : ""));
635
fprintf (stderr, "%s: `--%s' option given more than once%s\n",
636
package_name, long_opt,
637
(additional_error ? additional_error : ""));
638
return 1; /* failure */
642
if (field_given && *field_given && ! override)
649
val = possible_values[found];
653
if (val) *((int *)field) = strtol (val, &stop_char, 0);
657
string_field = (char **)field;
658
if (!no_free && *string_field)
659
free (*string_field); /* free previous string */
660
*string_field = gengetopt_strdup (val);
667
/* check numeric conversion */
670
if (val && !(stop_char && *stop_char == '\0')) {
671
fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val);
672
return 1; /* failure */
679
/* store the original value */
684
if (value && orig_field) {
689
free (*orig_field); /* free previous string */
690
*orig_field = gengetopt_strdup (value);
699
* @brief store information about a multiple option in a temporary list
700
* @param list where to (temporarily) store multiple options
703
int update_multiple_arg_temp(struct generic_list **list,
704
unsigned int *prev_given, const char *val,
705
char *possible_values[], const char *default_value,
706
test_modes_cmd_parser_arg_type arg_type,
707
const char *long_opt, char short_opt,
708
const char *additional_error)
710
char *multi_token, *multi_next; /* store single arguments */
712
if (arg_type == ARG_NO) {
717
multi_token = get_multiple_arg_token(val);
718
multi_next = get_multiple_arg_token_next (val);
723
if (update_arg((void *)&((*list)->arg), &((*list)->orig), 0,
724
prev_given, multi_token, possible_values, default_value,
725
arg_type, 0, 1, 1, 1, long_opt, short_opt, additional_error)) {
726
if (multi_token) free(multi_token);
727
return 1; /* failure */
732
multi_token = get_multiple_arg_token(multi_next);
733
multi_next = get_multiple_arg_token_next (multi_next);
743
* @brief free the passed list (including possible string argument)
746
void free_list(struct generic_list *list, short string_arg)
749
struct generic_list *tmp;
753
if (string_arg && list->arg.string_arg)
754
free (list->arg.string_arg);
764
* @brief updates a multiple option starting from the passed list
767
void update_multiple_arg(void *field, char ***orig_field,
768
unsigned int field_given, unsigned int prev_given, union generic_value *default_value,
769
test_modes_cmd_parser_arg_type arg_type,
770
struct generic_list *list)
773
struct generic_list *tmp;
775
if (prev_given && list) {
776
*orig_field = (char **) realloc (*orig_field, (field_given + prev_given) * sizeof (char *));
780
*((int **)field) = (int *)realloc (*((int **)field), (field_given + prev_given) * sizeof (int)); break;
782
*((char ***)field) = (char **)realloc (*((char ***)field), (field_given + prev_given) * sizeof (char *)); break;
787
for (i = (prev_given - 1); i >= 0; --i)
793
(*((int **)field))[i + field_given] = tmp->arg.int_arg; break;
795
(*((char ***)field))[i + field_given] = tmp->arg.string_arg; break;
799
(*orig_field) [i + field_given] = list->orig;
803
} else { /* set the default value */
804
if (default_value && ! field_given) {
807
if (! *((int **)field)) {
808
*((int **)field) = (int *)malloc (sizeof (int));
809
(*((int **)field))[0] = default_value->int_arg;
813
if (! *((char ***)field)) {
814
*((char ***)field) = (char **)malloc (sizeof (char *));
815
(*((char ***)field))[0] = gengetopt_strdup(default_value->string_arg);
820
if (!(*orig_field)) {
821
*orig_field = (char **) malloc (sizeof (char *));
822
(*orig_field)[0] = NULL;
828
static int check_modes(int given1[], const char *options1[],
829
int given2[], const char *options2[])
831
int i = 0, j = 0, errors = 0;
833
while (given1[i] >= 0) {
835
while (given2[j] >= 0) {
838
fprintf(stderr, "%s: option %s conflicts with option %s\n",
839
package_name, options1[i], options2[j]);
851
test_modes_cmd_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
852
struct test_modes_cmd_parser_params *params, const char *additional_error)
854
int c; /* Character of the parsed option. */
856
struct generic_list * optAmul_list = NULL;
858
struct gengetopt_args_info local_args_info;
865
package_name = argv[0];
867
override = params->override;
868
initialize = params->initialize;
869
check_required = params->check_required;
870
check_ambiguity = params->check_ambiguity;
873
test_modes_cmd_parser_init (args_info);
875
test_modes_cmd_parser_init (&local_args_info);
879
opterr = params->print_errors;
884
int option_index = 0;
886
static struct option long_options[] = {
887
{ "help", 0, NULL, 'h' },
888
{ "version", 0, NULL, 'V' },
889
{ "no-mode", 0, NULL, 'N' },
890
{ "no-mode2", 1, NULL, 0 },
891
{ "opta", 0, NULL, 'a' },
892
{ "optA", 2, NULL, 'A' },
893
{ "optAmul", 2, NULL, 'M' },
894
{ "optb", 0, NULL, 'b' },
895
{ "optc", 0, NULL, 0 },
896
{ "optd", 0, NULL, 'd' },
897
{ "mopt", 1, NULL, 'm' },
901
c = getopt_long (argc, argv, "hVNaA::M::bdm:", long_options, &option_index);
903
if (c == -1) break; /* Exit from `while (1)' loop. */
907
case 'h': /* Print help and exit. */
908
test_modes_cmd_parser_print_help ();
909
test_modes_cmd_parser_free (&local_args_info);
912
case 'V': /* Print version and exit. */
913
test_modes_cmd_parser_print_version ();
914
test_modes_cmd_parser_free (&local_args_info);
917
case 'N': /* a generic option not beloging to any mode. */
921
0 , &(args_info->no_mode_given),
922
&(local_args_info.no_mode_given), optarg, 0, 0, ARG_NO,
923
check_ambiguity, override, 0, 0,
929
case 'a': /* string a. */
930
args_info->mode1_mode_counter += 1;
932
local_args_info.opta_given++;
935
case 'A': /* string A. */
936
args_info->mode1_mode_counter += 1;
939
if (update_arg( (void *)&(args_info->optA_arg),
940
&(args_info->optA_orig), &(args_info->optA_given),
941
&(local_args_info.optA_given), optarg, 0, 0, ARG_STRING,
942
check_ambiguity, override, 0, 0,
948
case 'M': /* string M. */
949
args_info->mode1_mode_counter += 1;
951
if (update_multiple_arg_temp(&optAmul_list,
952
&(local_args_info.optAmul_given), optarg, 0, 0, ARG_STRING,
958
case 'b': /* string b. */
959
args_info->mode1_mode_counter += 1;
963
0 , &(args_info->optb_given),
964
&(local_args_info.optb_given), optarg, 0, 0, ARG_NO,
965
check_ambiguity, override, 0, 0,
971
case 'd': /* string d. */
972
args_info->mode_2_mode_counter += 1;
976
0 , &(args_info->optd_given),
977
&(local_args_info.optd_given), optarg, 0, 0, ARG_NO,
978
check_ambiguity, override, 0, 0,
984
case 'm': /* option of my mode. */
985
args_info->my_mode_mode_counter += 1;
988
if (update_arg( (void *)&(args_info->mopt_arg),
989
&(args_info->mopt_orig), &(args_info->mopt_given),
990
&(local_args_info.mopt_given), optarg, 0, 0, ARG_INT,
991
check_ambiguity, override, 0, 0,
998
case 0: /* Long option with no short option */
999
/* another generic option not beloging to any mode. */
1000
if (strcmp (long_options[option_index].name, "no-mode2") == 0)
1004
if (update_arg( (void *)&(args_info->no_mode2_arg),
1005
&(args_info->no_mode2_orig), &(args_info->no_mode2_given),
1006
&(local_args_info.no_mode2_given), optarg, 0, 0, ARG_STRING,
1007
check_ambiguity, override, 0, 0,
1014
else if (strcmp (long_options[option_index].name, "optc") == 0)
1016
args_info->mode_2_mode_counter += 1;
1020
0 , &(args_info->optc_given),
1021
&(local_args_info.optc_given), optarg, 0, 0, ARG_NO,
1022
check_ambiguity, override, 0, 0,
1030
case '?': /* Invalid option. */
1031
/* `getopt_long' already printed an error message. */
1034
default: /* bug: option not considered. */
1035
fprintf (stderr, "%s: option unknown: %c%s\n", TEST_MODES_CMD_PARSER_PACKAGE, c, (additional_error ? additional_error : ""));
1041
update_multiple_arg((void *)&(args_info->optAmul_arg),
1042
&(args_info->optAmul_orig), args_info->optAmul_given,
1043
local_args_info.optAmul_given, 0 ,
1044
ARG_STRING, optAmul_list);
1046
args_info->opta_given += local_args_info.opta_given;
1047
local_args_info.opta_given = 0;
1048
args_info->optAmul_given += local_args_info.optAmul_given;
1049
local_args_info.optAmul_given = 0;
1051
if (args_info->mode_2_mode_counter && args_info->mode1_mode_counter) {
1052
error += check_modes(
1053
(int []){args_info->optc_given, args_info->optd_given, -1},
1054
(const char *[]){"--optc", "--optd", 0},
1055
(int []){args_info->opta_given, args_info->optA_given, args_info->optAmul_given, args_info->optb_given, -1},
1056
(const char *[]){"--opta", "--optA", "--optAmul", "--optb", 0});
1058
if (args_info->mode_2_mode_counter && args_info->my_mode_mode_counter) {
1059
error += check_modes(
1060
(int []){args_info->optc_given, args_info->optd_given, -1},
1061
(const char *[]){"--optc", "--optd", 0},
1062
(int []){args_info->mopt_given, -1},
1063
(const char *[]){"--mopt", 0});
1065
if (args_info->mode1_mode_counter && args_info->my_mode_mode_counter) {
1066
error += check_modes(
1067
(int []){args_info->opta_given, args_info->optA_given, args_info->optAmul_given, args_info->optb_given, -1},
1068
(const char *[]){"--opta", "--optA", "--optAmul", "--optb", 0},
1069
(int []){args_info->mopt_given, -1},
1070
(const char *[]){"--mopt", 0});
1075
error += test_modes_cmd_parser_required2 (args_info, argv[0], additional_error);
1078
test_modes_cmd_parser_release (&local_args_info);
1081
return (EXIT_FAILURE);
1086
int found_prog_name = 0;
1087
/* whether program name, i.e., argv[0], is in the remaining args
1088
(this may happen with some implementations of getopt,
1089
but surely not with the one included by gengetopt) */
1093
if (argv[i++] == argv[0]) {
1094
found_prog_name = 1;
1099
args_info->inputs_num = argc - optind - found_prog_name;
1101
(char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
1102
while (optind < argc)
1103
if (argv[optind++] != argv[0])
1104
args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ;
1110
free_list (optAmul_list, 1 );
1112
test_modes_cmd_parser_release (&local_args_info);
1113
return (EXIT_FAILURE);