Bug Summary

File:idn_cmd.c
Location:line 542, column 3
Description:Value stored to 'check_required' is never read

Annotated Source Code

1/*
2 File autogenerated by gengetopt version 2.22.5
3 generated with the following command:
4 gengetopt --unamed-opts --no-handle-version --no-handle-help --set-package=idn --input idn.ggo --file-name idn_cmd Makefile.am
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_H1
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) (void) (X) /* avoid warnings for unused params */
22#endif
23
24#include <getoptrpl_getopt.h>
25
26#include "idn_cmd.h"
27
28const char *gengetopt_args_info_purpose = "";
29
30const char *gengetopt_args_info_usage = "Usage: idn [OPTION]... [STRING]...";
31
32const char *gengetopt_args_info_description = "";
33
34const char *gengetopt_args_info_full_help[] = {
35 " -h, --help Print help and exit",
36 " --full-help Print help, including hidden options, and exit",
37 " -V, --version Print version and exit",
38 " -s, --stringprep Prepare string according to nameprep profile",
39 " -d, --punycode-decode Decode Punycode",
40 " -e, --punycode-encode Encode Punycode",
41 " -a, --idna-to-ascii Convert to ACE according to IDNA (default)",
42 " -u, --idna-to-unicode Convert from ACE according to IDNA",
43 " --allow-unassigned Toggle IDNA AllowUnassigned flag (default=off)",
44 " --usestd3asciirules Toggle IDNA UseSTD3ASCIIRules flag (default=off)",
45 " -t, --tld Check string for TLD specific rules\n Only for --idna-to-ascii and --idna-to-unicode \n (default=on)",
46 " --no-tld Don't check string for TLD specific rules\n Only for --idna-to-ascii and --idna-to-unicode \n (default=off)",
47 " -n, --nfkc Normalize string according to Unicode v3.2 NFKC",
48 " -k, --hidden-nfkc Hidden parameter for backwards compatibility",
49 " -p, --profile=STRING Use specified stringprep profile instead\n Valid stringprep profiles are `Nameprep', `iSCSI', \n `Nodeprep', `Resourceprep', `trace', and \n `SASLprep'.",
50 " --debug Print debugging information (default=off)",
51 " --quiet Silent operation (default=off)",
52 0
53};
54
55static void
56init_help_array(void)
57{
58 gengetopt_args_info_help[0] = gengetopt_args_info_full_help[0];
59 gengetopt_args_info_help[1] = gengetopt_args_info_full_help[1];
60 gengetopt_args_info_help[2] = gengetopt_args_info_full_help[2];
61 gengetopt_args_info_help[3] = gengetopt_args_info_full_help[3];
62 gengetopt_args_info_help[4] = gengetopt_args_info_full_help[4];
63 gengetopt_args_info_help[5] = gengetopt_args_info_full_help[5];
64 gengetopt_args_info_help[6] = gengetopt_args_info_full_help[6];
65 gengetopt_args_info_help[7] = gengetopt_args_info_full_help[7];
66 gengetopt_args_info_help[8] = gengetopt_args_info_full_help[8];
67 gengetopt_args_info_help[9] = gengetopt_args_info_full_help[9];
68 gengetopt_args_info_help[10] = gengetopt_args_info_full_help[10];
69 gengetopt_args_info_help[11] = gengetopt_args_info_full_help[11];
70 gengetopt_args_info_help[12] = gengetopt_args_info_full_help[12];
71 gengetopt_args_info_help[13] = gengetopt_args_info_full_help[14];
72 gengetopt_args_info_help[14] = gengetopt_args_info_full_help[15];
73 gengetopt_args_info_help[15] = gengetopt_args_info_full_help[16];
74 gengetopt_args_info_help[16] = 0;
75
76}
77
78const char *gengetopt_args_info_help[17];
79
80typedef enum {ARG_NO
81 , ARG_FLAG
82 , ARG_STRING
83} cmdline_parser_arg_type;
84
85static
86void clear_given (struct gengetopt_args_info *args_info);
87static
88void clear_args (struct gengetopt_args_info *args_info);
89
90static int
91cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
92 struct cmdline_parser_params *params, const char *additional_error);
93
94
95static char *
96gengetopt_strdup (const char *s);
97
98static
99void clear_given (struct gengetopt_args_info *args_info)
100{
101 args_info->help_given = 0 ;
102 args_info->full_help_given = 0 ;
103 args_info->version_given = 0 ;
104 args_info->stringprep_given = 0 ;
105 args_info->punycode_decode_given = 0 ;
106 args_info->punycode_encode_given = 0 ;
107 args_info->idna_to_ascii_given = 0 ;
108 args_info->idna_to_unicode_given = 0 ;
109 args_info->allow_unassigned_given = 0 ;
110 args_info->usestd3asciirules_given = 0 ;
111 args_info->tld_given = 0 ;
112 args_info->no_tld_given = 0 ;
113 args_info->nfkc_given = 0 ;
114 args_info->hidden_nfkc_given = 0 ;
115 args_info->profile_given = 0 ;
116 args_info->debug_given = 0 ;
117 args_info->quiet_given = 0 ;
118}
119
120static
121void clear_args (struct gengetopt_args_info *args_info)
122{
123 FIX_UNUSED (args_info)(void) (args_info);
124 args_info->allow_unassigned_flag = 0;
125 args_info->usestd3asciirules_flag = 0;
126 args_info->tld_flag = 1;
127 args_info->no_tld_flag = 0;
128 args_info->profile_arg = NULL((void*)0);
129 args_info->profile_orig = NULL((void*)0);
130 args_info->debug_flag = 0;
131 args_info->quiet_flag = 0;
132
133}
134
135static
136void init_args_info(struct gengetopt_args_info *args_info)
137{
138
139 init_help_array();
140 args_info->help_help = gengetopt_args_info_full_help[0] ;
141 args_info->full_help_help = gengetopt_args_info_full_help[1] ;
142 args_info->version_help = gengetopt_args_info_full_help[2] ;
143 args_info->stringprep_help = gengetopt_args_info_full_help[3] ;
144 args_info->punycode_decode_help = gengetopt_args_info_full_help[4] ;
145 args_info->punycode_encode_help = gengetopt_args_info_full_help[5] ;
146 args_info->idna_to_ascii_help = gengetopt_args_info_full_help[6] ;
147 args_info->idna_to_unicode_help = gengetopt_args_info_full_help[7] ;
148 args_info->allow_unassigned_help = gengetopt_args_info_full_help[8] ;
149 args_info->usestd3asciirules_help = gengetopt_args_info_full_help[9] ;
150 args_info->tld_help = gengetopt_args_info_full_help[10] ;
151 args_info->no_tld_help = gengetopt_args_info_full_help[11] ;
152 args_info->nfkc_help = gengetopt_args_info_full_help[12] ;
153 args_info->hidden_nfkc_help = gengetopt_args_info_full_help[13] ;
154 args_info->profile_help = gengetopt_args_info_full_help[14] ;
155 args_info->debug_help = gengetopt_args_info_full_help[15] ;
156 args_info->quiet_help = gengetopt_args_info_full_help[16] ;
157
158}
159
160void
161cmdline_parser_print_version (void)
162{
163 printf ("%s %s\n",
164 (strlen(CMDLINE_PARSER_PACKAGE_NAME"idn") ? CMDLINE_PARSER_PACKAGE_NAME"idn" : CMDLINE_PARSER_PACKAGE"idn"),
165 CMDLINE_PARSER_VERSION"1.28");
166}
167
168static void print_help_common(void) {
169 cmdline_parser_print_version ();
170
171 if (strlen(gengetopt_args_info_purpose) > 0)
172 printf("\n%s\n", gengetopt_args_info_purpose);
173
174 if (strlen(gengetopt_args_info_usage) > 0)
175 printf("\n%s\n", gengetopt_args_info_usage);
176
177 printf("\n");
178
179 if (strlen(gengetopt_args_info_description) > 0)
180 printf("%s\n\n", gengetopt_args_info_description);
181}
182
183void
184cmdline_parser_print_help (void)
185{
186 int i = 0;
187 print_help_common();
188 while (gengetopt_args_info_help[i])
189 printf("%s\n", gengetopt_args_info_help[i++]);
190}
191
192void
193cmdline_parser_print_full_help (void)
194{
195 int i = 0;
196 print_help_common();
197 while (gengetopt_args_info_full_help[i])
198 printf("%s\n", gengetopt_args_info_full_help[i++]);
199}
200
201void
202cmdline_parser_init (struct gengetopt_args_info *args_info)
203{
204 clear_given (args_info);
205 clear_args (args_info);
206 init_args_info (args_info);
207
208 args_info->inputs = 0;
209 args_info->inputs_num = 0;
210}
211
212void
213cmdline_parser_params_init(struct cmdline_parser_params *params)
214{
215 if (params)
216 {
217 params->override = 0;
218 params->initialize = 1;
219 params->check_required = 1;
220 params->check_ambiguity = 0;
221 params->print_errors = 1;
222 }
223}
224
225struct cmdline_parser_params *
226cmdline_parser_params_create(void)
227{
228 struct cmdline_parser_params *params =
229 (struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params));
230 cmdline_parser_params_init(params);
231 return params;
232}
233
234static void
235free_string_field (char **s)
236{
237 if (*s)
238 {
239 free (*s);
240 *s = 0;
241 }
242}
243
244
245static void
246cmdline_parser_release (struct gengetopt_args_info *args_info)
247{
248 unsigned int i;
249 free_string_field (&(args_info->profile_arg));
250 free_string_field (&(args_info->profile_orig));
251
252
253 for (i = 0; i < args_info->inputs_num; ++i)
254 free (args_info->inputs [i]);
255
256 if (args_info->inputs_num)
257 free (args_info->inputs);
258
259 clear_given (args_info);
260}
261
262
263static void
264write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
265{
266 FIX_UNUSED (values)(void) (values);
267 if (arg) {
268 fprintf(outfile, "%s=\"%s\"\n", opt, arg);
269 } else {
270 fprintf(outfile, "%s\n", opt);
271 }
272}
273
274
275int
276cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
277{
278 int i = 0;
279
280 if (!outfile)
281 {
282 fprintf (stderrstderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE"idn");
283 return EXIT_FAILURE1;
284 }
285
286 if (args_info->help_given)
287 write_into_file(outfile, "help", 0, 0 );
288 if (args_info->full_help_given)
289 write_into_file(outfile, "full-help", 0, 0 );
290 if (args_info->version_given)
291 write_into_file(outfile, "version", 0, 0 );
292 if (args_info->stringprep_given)
293 write_into_file(outfile, "stringprep", 0, 0 );
294 if (args_info->punycode_decode_given)
295 write_into_file(outfile, "punycode-decode", 0, 0 );
296 if (args_info->punycode_encode_given)
297 write_into_file(outfile, "punycode-encode", 0, 0 );
298 if (args_info->idna_to_ascii_given)
299 write_into_file(outfile, "idna-to-ascii", 0, 0 );
300 if (args_info->idna_to_unicode_given)
301 write_into_file(outfile, "idna-to-unicode", 0, 0 );
302 if (args_info->allow_unassigned_given)
303 write_into_file(outfile, "allow-unassigned", 0, 0 );
304 if (args_info->usestd3asciirules_given)
305 write_into_file(outfile, "usestd3asciirules", 0, 0 );
306 if (args_info->tld_given)
307 write_into_file(outfile, "tld", 0, 0 );
308 if (args_info->no_tld_given)
309 write_into_file(outfile, "no-tld", 0, 0 );
310 if (args_info->nfkc_given)
311 write_into_file(outfile, "nfkc", 0, 0 );
312 if (args_info->hidden_nfkc_given)
313 write_into_file(outfile, "hidden-nfkc", 0, 0 );
314 if (args_info->profile_given)
315 write_into_file(outfile, "profile", args_info->profile_orig, 0);
316 if (args_info->debug_given)
317 write_into_file(outfile, "debug", 0, 0 );
318 if (args_info->quiet_given)
319 write_into_file(outfile, "quiet", 0, 0 );
320
321
322 i = EXIT_SUCCESS0;
323 return i;
324}
325
326int
327cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info)
328{
329 FILE *outfile;
330 int i = 0;
331
332 outfile = fopen(filename, "w");
333
334 if (!outfile)
335 {
336 fprintf (stderrstderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE"idn", filename);
337 return EXIT_FAILURE1;
338 }
339
340 i = cmdline_parser_dump(outfile, args_info);
341 fclose (outfile);
342
343 return i;
344}
345
346void
347cmdline_parser_free (struct gengetopt_args_info *args_info)
348{
349 cmdline_parser_release (args_info);
350}
351
352/** @brief replacement of strdup, which is not standard */
353char *
354gengetopt_strdup (const char *s)
355{
356 char *result = 0;
357 if (!s)
358 return result;
359
360 result = (char*)malloc(strlen(s) + 1);
361 if (result == (char*)0)
362 return (char*)0;
363 strcpy(result, s);
364 return result;
365}
366
367int
368cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
369{
370 return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
371}
372
373int
374cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
375 struct cmdline_parser_params *params)
376{
377 int result;
378 result = cmdline_parser_internal (argc, argv, args_info, params, 0);
379
380 if (result == EXIT_FAILURE1)
381 {
382 cmdline_parser_free (args_info);
383 exit (EXIT_FAILURE1);
384 }
385
386 return result;
387}
388
389int
390cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
391{
392 int result;
393 struct cmdline_parser_params params;
394
395 params.override = override;
396 params.initialize = initialize;
397 params.check_required = check_required;
398 params.check_ambiguity = 0;
399 params.print_errors = 1;
400
401 result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
402
403 if (result == EXIT_FAILURE1)
404 {
405 cmdline_parser_free (args_info);
406 exit (EXIT_FAILURE1);
407 }
408
409 return result;
410}
411
412int
413cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name)
414{
415 FIX_UNUSED (args_info)(void) (args_info);
416 FIX_UNUSED (prog_name)(void) (prog_name);
417 return EXIT_SUCCESS0;
418}
419
420
421static char *package_name = 0;
422
423/**
424 * @brief updates an option
425 * @param field the generic pointer to the field to update
426 * @param orig_field the pointer to the orig field
427 * @param field_given the pointer to the number of occurrence of this option
428 * @param prev_given the pointer to the number of occurrence already seen
429 * @param value the argument for this option (if null no arg was specified)
430 * @param possible_values the possible values for this option (if specified)
431 * @param default_value the default value (in case the option only accepts fixed values)
432 * @param arg_type the type of this option
433 * @param check_ambiguity @see cmdline_parser_params.check_ambiguity
434 * @param override @see cmdline_parser_params.override
435 * @param no_free whether to free a possible previous value
436 * @param multiple_option whether this is a multiple option
437 * @param long_opt the corresponding long option
438 * @param short_opt the corresponding short option (or '-' if none)
439 * @param additional_error possible further error specification
440 */
441static
442int update_arg(void *field, char **orig_field,
443 unsigned int *field_given, unsigned int *prev_given,
444 char *value, const char *possible_values[],
445 const char *default_value,
446 cmdline_parser_arg_type arg_type,
447 int check_ambiguity, int override,
448 int no_free, int multiple_option,
449 const char *long_opt, char short_opt,
450 const char *additional_error)
451{
452 char *stop_char = 0;
453 const char *val = value;
454 int found;
455 char **string_field;
456 FIX_UNUSED (field)(void) (field);
457
458 stop_char = 0;
459 found = 0;
460
461 if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given)))
462 {
463 if (short_opt != '-')
464 fprintf (stderrstderr, "%s: `--%s' (`-%c') option given more than once%s\n",
465 package_name, long_opt, short_opt,
466 (additional_error ? additional_error : ""));
467 else
468 fprintf (stderrstderr, "%s: `--%s' option given more than once%s\n",
469 package_name, long_opt,
470 (additional_error ? additional_error : ""));
471 return 1; /* failure */
472 }
473
474 FIX_UNUSED (default_value)(void) (default_value);
475
476 if (field_given && *field_given && ! override)
477 return 0;
478 if (prev_given)
479 (*prev_given)++;
480 if (field_given)
481 (*field_given)++;
482 if (possible_values)
483 val = possible_values[found];
484
485 switch(arg_type) {
486 case ARG_FLAG:
487 *((int *)field) = !*((int *)field);
488 break;
489 case ARG_STRING:
490 if (val) {
491 string_field = (char **)field;
492 if (!no_free && *string_field)
493 free (*string_field); /* free previous string */
494 *string_field = gengetopt_strdup (val);
495 }
496 break;
497 default:
498 break;
499 };
500
501
502 /* store the original value */
503 switch(arg_type) {
504 case ARG_NO:
505 case ARG_FLAG:
506 break;
507 default:
508 if (value && orig_field) {
509 if (no_free) {
510 *orig_field = value;
511 } else {
512 if (*orig_field)
513 free (*orig_field); /* free previous string */
514 *orig_field = gengetopt_strdup (value);
515 }
516 }
517 };
518
519 return 0; /* OK */
520}
521
522
523int
524cmdline_parser_internal (
525 int argc, char **argv, struct gengetopt_args_info *args_info,
526 struct cmdline_parser_params *params, const char *additional_error)
527{
528 int c; /* Character of the parsed option. */
529
530 int error = 0;
531 struct gengetopt_args_info local_args_info;
532
533 int override;
534 int initialize;
535 int check_required;
536 int check_ambiguity;
537
538 package_name = argv[0];
539
540 override = params->override;
541 initialize = params->initialize;
542 check_required = params->check_required;
Value stored to 'check_required' is never read
543 check_ambiguity = params->check_ambiguity;
544
545 if (initialize)
546 cmdline_parser_init (args_info);
547
548 cmdline_parser_init (&local_args_info);
549
550 optargrpl_optarg = 0;
551 optindrpl_optind = 0;
552 opterrrpl_opterr = params->print_errors;
553 optoptrpl_optopt = '?';
554
555 while (1)
556 {
557 int option_index = 0;
558
559 static struct optionrpl_option long_options[] = {
560 { "help", 0, NULL((void*)0), 'h' },
561 { "full-help", 0, NULL((void*)0), 0 },
562 { "version", 0, NULL((void*)0), 'V' },
563 { "stringprep", 0, NULL((void*)0), 's' },
564 { "punycode-decode", 0, NULL((void*)0), 'd' },
565 { "punycode-encode", 0, NULL((void*)0), 'e' },
566 { "idna-to-ascii", 0, NULL((void*)0), 'a' },
567 { "idna-to-unicode", 0, NULL((void*)0), 'u' },
568 { "allow-unassigned", 0, NULL((void*)0), 0 },
569 { "usestd3asciirules", 0, NULL((void*)0), 0 },
570 { "tld", 0, NULL((void*)0), 't' },
571 { "no-tld", 0, NULL((void*)0), 0 },
572 { "nfkc", 0, NULL((void*)0), 'n' },
573 { "hidden-nfkc", 0, NULL((void*)0), 'k' },
574 { "profile", 1, NULL((void*)0), 'p' },
575 { "debug", 0, NULL((void*)0), 0 },
576 { "quiet", 0, NULL((void*)0), 0 },
577 { 0, 0, 0, 0 }
578 };
579
580 c = getopt_longrpl_getopt_long (argc, argv, "hVsdeautnkp:", long_options, &option_index);
581
582 if (c == -1) break; /* Exit from `while (1)' loop. */
583
584 switch (c)
585 {
586 case 'h': /* Print help and exit. */
587
588
589 if (update_arg( 0 ,
590 0 , &(args_info->help_given),
591 &(local_args_info.help_given), optargrpl_optarg, 0, 0, ARG_NO,
592 check_ambiguity, override, 0, 0,
593 "help", 'h',
594 additional_error))
595 goto failure;
596 cmdline_parser_free (&local_args_info);
597 return 0;
598
599 break;
600 case 'V': /* Print version and exit. */
601
602
603 if (update_arg( 0 ,
604 0 , &(args_info->version_given),
605 &(local_args_info.version_given), optargrpl_optarg, 0, 0, ARG_NO,
606 check_ambiguity, override, 0, 0,
607 "version", 'V',
608 additional_error))
609 goto failure;
610 cmdline_parser_free (&local_args_info);
611 return 0;
612
613 break;
614 case 's': /* Prepare string according to nameprep profile. */
615
616
617 if (update_arg( 0 ,
618 0 , &(args_info->stringprep_given),
619 &(local_args_info.stringprep_given), optargrpl_optarg, 0, 0, ARG_NO,
620 check_ambiguity, override, 0, 0,
621 "stringprep", 's',
622 additional_error))
623 goto failure;
624
625 break;
626 case 'd': /* Decode Punycode. */
627
628
629 if (update_arg( 0 ,
630 0 , &(args_info->punycode_decode_given),
631 &(local_args_info.punycode_decode_given), optargrpl_optarg, 0, 0, ARG_NO,
632 check_ambiguity, override, 0, 0,
633 "punycode-decode", 'd',
634 additional_error))
635 goto failure;
636
637 break;
638 case 'e': /* Encode Punycode. */
639
640
641 if (update_arg( 0 ,
642 0 , &(args_info->punycode_encode_given),
643 &(local_args_info.punycode_encode_given), optargrpl_optarg, 0, 0, ARG_NO,
644 check_ambiguity, override, 0, 0,
645 "punycode-encode", 'e',
646 additional_error))
647 goto failure;
648
649 break;
650 case 'a': /* Convert to ACE according to IDNA (default). */
651
652
653 if (update_arg( 0 ,
654 0 , &(args_info->idna_to_ascii_given),
655 &(local_args_info.idna_to_ascii_given), optargrpl_optarg, 0, 0, ARG_NO,
656 check_ambiguity, override, 0, 0,
657 "idna-to-ascii", 'a',
658 additional_error))
659 goto failure;
660
661 break;
662 case 'u': /* Convert from ACE according to IDNA. */
663
664
665 if (update_arg( 0 ,
666 0 , &(args_info->idna_to_unicode_given),
667 &(local_args_info.idna_to_unicode_given), optargrpl_optarg, 0, 0, ARG_NO,
668 check_ambiguity, override, 0, 0,
669 "idna-to-unicode", 'u',
670 additional_error))
671 goto failure;
672
673 break;
674 case 't': /* Check string for TLD specific rules
675 Only for --idna-to-ascii and --idna-to-unicode. */
676
677
678 if (update_arg((void *)&(args_info->tld_flag), 0, &(args_info->tld_given),
679 &(local_args_info.tld_given), optargrpl_optarg, 0, 0, ARG_FLAG,
680 check_ambiguity, override, 1, 0, "tld", 't',
681 additional_error))
682 goto failure;
683
684 break;
685 case 'n': /* Normalize string according to Unicode v3.2 NFKC. */
686
687
688 if (update_arg( 0 ,
689 0 , &(args_info->nfkc_given),
690 &(local_args_info.nfkc_given), optargrpl_optarg, 0, 0, ARG_NO,
691 check_ambiguity, override, 0, 0,
692 "nfkc", 'n',
693 additional_error))
694 goto failure;
695
696 break;
697 case 'k': /* Hidden parameter for backwards compatibility. */
698
699
700 if (update_arg( 0 ,
701 0 , &(args_info->hidden_nfkc_given),
702 &(local_args_info.hidden_nfkc_given), optargrpl_optarg, 0, 0, ARG_NO,
703 check_ambiguity, override, 0, 0,
704 "hidden-nfkc", 'k',
705 additional_error))
706 goto failure;
707
708 break;
709 case 'p': /* Use specified stringprep profile instead
710 Valid stringprep profiles are `Nameprep', `iSCSI', `Nodeprep', `Resourceprep', `trace', and `SASLprep'.. */
711
712
713 if (update_arg( (void *)&(args_info->profile_arg),
714 &(args_info->profile_orig), &(args_info->profile_given),
715 &(local_args_info.profile_given), optargrpl_optarg, 0, 0, ARG_STRING,
716 check_ambiguity, override, 0, 0,
717 "profile", 'p',
718 additional_error))
719 goto failure;
720
721 break;
722
723 case 0: /* Long option with no short option */
724 /* Print help, including hidden options, and exit. */
725 if (strcmp (long_options[option_index].name, "full-help") == 0)
726 {
727
728
729 if (update_arg( 0 ,
730 0 , &(args_info->full_help_given),
731 &(local_args_info.full_help_given), optargrpl_optarg, 0, 0, ARG_NO,
732 check_ambiguity, override, 0, 0,
733 "full-help", '-',
734 additional_error))
735 goto failure;
736 cmdline_parser_free (&local_args_info);
737 return 0;
738
739 }
740 /* Toggle IDNA AllowUnassigned flag. */
741 else if (strcmp (long_options[option_index].name, "allow-unassigned") == 0)
742 {
743
744
745 if (update_arg((void *)&(args_info->allow_unassigned_flag), 0, &(args_info->allow_unassigned_given),
746 &(local_args_info.allow_unassigned_given), optargrpl_optarg, 0, 0, ARG_FLAG,
747 check_ambiguity, override, 1, 0, "allow-unassigned", '-',
748 additional_error))
749 goto failure;
750
751 }
752 /* Toggle IDNA UseSTD3ASCIIRules flag. */
753 else if (strcmp (long_options[option_index].name, "usestd3asciirules") == 0)
754 {
755
756
757 if (update_arg((void *)&(args_info->usestd3asciirules_flag), 0, &(args_info->usestd3asciirules_given),
758 &(local_args_info.usestd3asciirules_given), optargrpl_optarg, 0, 0, ARG_FLAG,
759 check_ambiguity, override, 1, 0, "usestd3asciirules", '-',
760 additional_error))
761 goto failure;
762
763 }
764 /* Don't check string for TLD specific rules
765 Only for --idna-to-ascii and --idna-to-unicode. */
766 else if (strcmp (long_options[option_index].name, "no-tld") == 0)
767 {
768
769
770 if (update_arg((void *)&(args_info->no_tld_flag), 0, &(args_info->no_tld_given),
771 &(local_args_info.no_tld_given), optargrpl_optarg, 0, 0, ARG_FLAG,
772 check_ambiguity, override, 1, 0, "no-tld", '-',
773 additional_error))
774 goto failure;
775
776 }
777 /* Print debugging information. */
778 else if (strcmp (long_options[option_index].name, "debug") == 0)
779 {
780
781
782 if (update_arg((void *)&(args_info->debug_flag), 0, &(args_info->debug_given),
783 &(local_args_info.debug_given), optargrpl_optarg, 0, 0, ARG_FLAG,
784 check_ambiguity, override, 1, 0, "debug", '-',
785 additional_error))
786 goto failure;
787
788 }
789 /* Silent operation. */
790 else if (strcmp (long_options[option_index].name, "quiet") == 0)
791 {
792
793
794 if (update_arg((void *)&(args_info->quiet_flag), 0, &(args_info->quiet_given),
795 &(local_args_info.quiet_given), optargrpl_optarg, 0, 0, ARG_FLAG,
796 check_ambiguity, override, 1, 0, "quiet", '-',
797 additional_error))
798 goto failure;
799
800 }
801
802 break;
803 case '?': /* Invalid option. */
804 /* `getopt_long' already printed an error message. */
805 goto failure;
806
807 default: /* bug: option not considered. */
808 fprintf (stderrstderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE"idn", c, (additional_error ? additional_error : ""));
809 abort ();
810 } /* switch */
811 } /* while */
812
813
814
815
816 cmdline_parser_release (&local_args_info);
817
818 if ( error )
819 return (EXIT_FAILURE1);
820
821 if (optindrpl_optind < argc)
822 {
823 int i = 0 ;
824 int found_prog_name = 0;
825 /* whether program name, i.e., argv[0], is in the remaining args
826 (this may happen with some implementations of getopt,
827 but surely not with the one included by gengetopt) */
828
829 i = optindrpl_optind;
830 while (i < argc)
831 if (argv[i++] == argv[0]) {
832 found_prog_name = 1;
833 break;
834 }
835 i = 0;
836
837 args_info->inputs_num = argc - optindrpl_optind - found_prog_name;
838 args_info->inputs =
839 (char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ;
840 while (optindrpl_optind < argc)
841 if (argv[optindrpl_optind++] != argv[0])
842 args_info->inputs[ i++ ] = gengetopt_strdup (argv[optindrpl_optind-1]) ;
843 }
844
845 return 0;
846
847failure:
848
849 cmdline_parser_release (&local_args_info);
850 return (EXIT_FAILURE1);
851}