summaryrefslogtreecommitdiffstats
path: root/misc-utils/getopt.c
diff options
context:
space:
mode:
authorKarel Zak2014-12-09 12:17:57 +0100
committerKarel Zak2014-12-09 12:17:57 +0100
commitc29b090fc5bd427b899681013a0d98c3c417ea23 (patch)
tree60035832bd09e3240476d1769851a6c6fb9b5bc2 /misc-utils/getopt.c
parentgetopt: fix compiler warning (diff)
downloadkernel-qcow2-util-linux-c29b090fc5bd427b899681013a0d98c3c417ea23.tar.gz
kernel-qcow2-util-linux-c29b090fc5bd427b899681013a0d98c3c417ea23.tar.xz
kernel-qcow2-util-linux-c29b090fc5bd427b899681013a0d98c3c417ea23.zip
getopt: rename function to keep code readable
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/getopt.c')
-rw-r--r--misc-utils/getopt.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/misc-utils/getopt.c b/misc-utils/getopt.c
index 4802d95ba..644d552c9 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;