]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
getopt: rename function to keep code readable
authorKarel Zak <kzak@redhat.com>
Tue, 9 Dec 2014 11:17:57 +0000 (12:17 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 9 Dec 2014 11:17:57 +0000 (12:17 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/getopt.c

index 4802d95ba0db13da6ba3d27b8bc12d0d293b7dc9..644d552c905d8096ab43d43532e10071253d3363 100644 (file)
@@ -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;