From 019fd57f70297d216c6b80b89112307db994b74e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Tue, 9 Apr 2019 16:58:18 +0200 Subject: [PATCH 2/3] Manually create idn2_cmd.c and idn2_cmd.h due to idn2.ggo diff -ru goo_before/src/idn2_cmd.c goo/src/idn2_cmd.c --- goo_before/src/idn2_cmd.c 2020-03-17 23:09:46.872000000 +0800 +++ goo/src/idn2_cmd.c 2020-03-17 23:07:45.844000000 +0800 @@ -1,5 +1,5 @@ /* - File autogenerated by gengetopt version 2.22.6 + File autogenerated by gengetopt version 2.23 generated with the following command: gengetopt --unamed-opts --no-handle-version --no-handle-help --set-package=idn2 --input idn2.ggo --file-name idn2_cmd @@ -27,24 +27,25 @@ const char *gengetopt_args_info_purpose = ""; -const char *gengetopt_args_info_usage = "Usage: idn2 [OPTION]... [STRING]..."; +const char *gengetopt_args_info_usage = "Usage: idn2 [OPTION]... [FILE]..."; const char *gengetopt_args_info_versiontext = ""; const char *gengetopt_args_info_description = ""; const char *gengetopt_args_info_help[] = { - " -h, --help Print help and exit", - " -V, --version Print version and exit", - " -d, --decode Decode (punycode) domain name", - " -l, --lookup Lookup domain name (default)", - " -r, --register Register label", - " -T, --tr46t Enable TR46 transitional processing (default=off)", - " -N, --tr46nt Enable TR46 non-transitional processing\n (default=off)", - " --no-tr46 Disable TR46 processing (default=off)", - " --usestd3asciirules Enable STD3 ASCII rules (default=off)", - " --debug Print debugging information (default=off)", - " --quiet Silent operation (default=off)", + " -h, --help Print help and exit", + " -V, --version Print version and exit", + " -d, --decode Decode (punycode) domain name", + " -l, --lookup Lookup domain name (default)", + " -r, --register Register label", + " -T, --tr46t Enable TR46 transitional processing (default=off)", + " -N, --tr46nt Enable TR46 non-transitional processing\n (default=off)", + " --no-tr46 Disable TR46 processing (default=off)", + " --usestd3asciirules Enable STD3 ASCII rules (default=off)", + " --no-alabelroundtrip Disable ALabel roundtrip for lookups (default=off)", + " --debug Print debugging information (default=off)", + " --quiet Silent operation (default=off)", 0 }; @@ -77,6 +78,7 @@ args_info->tr46nt_given = 0 ; args_info->no_tr46_given = 0 ; args_info->usestd3asciirules_given = 0 ; + args_info->no_alabelroundtrip_given = 0 ; args_info->debug_given = 0 ; args_info->quiet_given = 0 ; } @@ -89,6 +91,7 @@ args_info->tr46nt_flag = 0; args_info->no_tr46_flag = 0; args_info->usestd3asciirules_flag = 0; + args_info->no_alabelroundtrip_flag = 0; args_info->debug_flag = 0; args_info->quiet_flag = 0; @@ -108,8 +111,9 @@ args_info->tr46nt_help = gengetopt_args_info_help[6] ; args_info->no_tr46_help = gengetopt_args_info_help[7] ; args_info->usestd3asciirules_help = gengetopt_args_info_help[8] ; - args_info->debug_help = gengetopt_args_info_help[9] ; - args_info->quiet_help = gengetopt_args_info_help[10] ; + args_info->no_alabelroundtrip_help = gengetopt_args_info_help[9] ; + args_info->debug_help = gengetopt_args_info_help[10] ; + args_info->quiet_help = gengetopt_args_info_help[11] ; } @@ -124,19 +128,25 @@ printf("\n%s\n", gengetopt_args_info_versiontext); } -static void print_help_common(void) { - cmdline_parser_print_version (); - - if (strlen(gengetopt_args_info_purpose) > 0) - printf("\n%s\n", gengetopt_args_info_purpose); - - if (strlen(gengetopt_args_info_usage) > 0) - printf("\n%s\n", gengetopt_args_info_usage); - - printf("\n"); +static void print_help_common(void) +{ + size_t len_purpose = strlen(gengetopt_args_info_purpose); + size_t len_usage = strlen(gengetopt_args_info_usage); - if (strlen(gengetopt_args_info_description) > 0) - printf("%s\n\n", gengetopt_args_info_description); + if (len_usage > 0) { + printf("%s\n", gengetopt_args_info_usage); + } + if (len_purpose > 0) { + printf("%s\n", gengetopt_args_info_purpose); + } + + if (len_usage || len_purpose) { + printf("\n"); + } + + if (strlen(gengetopt_args_info_description) > 0) { + printf("%s\n\n", gengetopt_args_info_description); + } } void @@ -240,6 +250,8 @@ write_into_file(outfile, "no-tr46", 0, 0 ); if (args_info->usestd3asciirules_given) write_into_file(outfile, "usestd3asciirules", 0, 0 ); + if (args_info->no_alabelroundtrip_given) + write_into_file(outfile, "no-alabelroundtrip", 0, 0 ); if (args_info->debug_given) write_into_file(outfile, "debug", 0, 0 ); if (args_info->quiet_given) @@ -416,7 +428,9 @@ break; }; - + FIX_UNUSED(stop_char); + FIX_UNUSED(val); + /* store the original value */ switch(arg_type) { case ARG_NO: @@ -455,10 +469,16 @@ package_name = argv[0]; + /* TODO: Why is this here? It is not used anywhere. */ override = params->override; + FIX_UNUSED(override); + initialize = params->initialize; check_required = params->check_required; + + /* TODO: Why is this here? It is not used anywhere. */ check_ambiguity = params->check_ambiguity; + FIX_UNUSED(check_ambiguity); if (initialize) cmdline_parser_init (args_info); @@ -484,6 +504,7 @@ { "tr46nt", 0, NULL, 'N' }, { "no-tr46", 0, NULL, 0 }, { "usestd3asciirules", 0, NULL, 0 }, + { "no-alabelroundtrip", 0, NULL, 0 }, { "debug", 0, NULL, 0 }, { "quiet", 0, NULL, 0 }, { 0, 0, 0, 0 } @@ -605,6 +626,18 @@ goto failure; } + /* Disable ALabel roundtrip for lookups. */ + else if (strcmp (long_options[option_index].name, "no-alabelroundtrip") == 0) + { + + + if (update_arg((void *)&(args_info->no_alabelroundtrip_flag), 0, &(args_info->no_alabelroundtrip_given), + &(local_args_info.no_alabelroundtrip_given), optarg, 0, 0, ARG_FLAG, + check_ambiguity, override, 1, 0, "no-alabelroundtrip", '-', + additional_error)) + goto failure; + + } /* Print debugging information. */ else if (strcmp (long_options[option_index].name, "debug") == 0) { @@ -643,6 +676,7 @@ + FIX_UNUSED(check_required); cmdline_parser_release (&local_args_info); @@ -680,3 +714,4 @@ cmdline_parser_release (&local_args_info); return (EXIT_FAILURE); } +/* vim: set ft=c noet ts=8 sts=8 sw=8 tw=80 nojs spell : */