Bug Summary

File:src/idn_cmd.c
Location:line 492, column 24
Description:Dereference of null pointer

Annotated Source Code

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