From: Karel Zak Date: Tue, 9 Dec 2014 11:17:57 +0000 (+0100) Subject: getopt: rename function to keep code readable X-Git-Tag: v2.26-rc1~138 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c29b090fc5bd427b899681013a0d98c3c417ea23;p=thirdparty%2Futil-linux.git getopt: rename function to keep code readable Signed-off-by: Karel Zak --- diff --git a/misc-utils/getopt.c b/misc-utils/getopt.c index 4802d95ba0..644d552c90 100644 --- a/misc-utils/getopt.c +++ b/misc-utils/getopt.c @@ -96,7 +96,7 @@ int (*getopt_long_fp) (int argc, char *const *argv, const char *optstr, const struct option * longopts, int *longindex); /* - * This function 'normalizes' a single argument: it puts single quotes + * This function 'print_normalizeds' a single argument: it puts single quotes * around it and escapes other special characters. If quote is false, it * just returns its argument. * @@ -104,7 +104,7 @@ int (*getopt_long_fp) (int argc, char *const *argv, const char *optstr, * exclamation marks within single quotes, and nukes whitespace. This * function returns a pointer to a buffer that is overwritten by each call. */ -static void normalize(const struct getopt_control *ctl, const char *arg) +static void print_normalized(const struct getopt_control *ctl, const char *arg) { char *buf; const char *argptr = arg; @@ -201,23 +201,23 @@ static int generate_output(const struct getopt_control *ctl, char *argv[], int a case LONG_OPT: printf(" --%s", ctl->long_options[longindex].name); if (ctl->long_options[longindex].has_arg) - normalize(ctl, optarg ? optarg : ""); + print_normalized(ctl, optarg ? optarg : ""); break; case NON_OPT: - normalize(ctl, optarg ? optarg : ""); + print_normalized(ctl, optarg ? optarg : ""); break; default: printf(" -%c", opt); charptr = strchr(ctl->optstr, opt); if (charptr != NULL && *++charptr == ':') - normalize(ctl, optarg ? optarg : ""); + print_normalized(ctl, optarg ? optarg : ""); } } if (!ctl->quiet_output) { printf(" --"); while (optind < argc) - normalize(ctl, argv[optind++]); + print_normalized(ctl, argv[optind++]); printf("\n"); } return exit_code;