sar: Rename option -h to --help
authorSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 12 Jan 2018 08:35:20 +0000 (09:35 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Fri, 12 Jan 2018 08:35:20 +0000 (09:35 +0100)
Option --help displays a help message.
Option -h will be used to make sar's output easier to read by a human.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
sar.c

diff --git a/sar.c b/sar.c
index 269c38ae49093367ed07eadbaa91af939fe7c251..4154d6e8d9062f58b96762a8344eac2b5a7b944c 100644 (file)
--- a/sar.c
+++ b/sar.c
@@ -113,9 +113,9 @@ void usage(char *progname)
 {
        print_usage_title(stderr, progname);
        fprintf(stderr, _("Options are:\n"
-                         "[ -A ] [ -B ] [ -b ] [ -C ] [ -D ] [ -d ] [ -F [ MOUNT ] ] [ -H ] [ -h ]\n"
+                         "[ -A ] [ -B ] [ -b ] [ -C ] [ -D ] [ -d ] [ -F [ MOUNT ] ] [ -H ]\n"
                          "[ -p ] [ -q ] [ -r [ ALL ] ] [ -S ] [ -t ] [ -u [ ALL ] ] [ -V ]\n"
-                         "[ -v ] [ -W ] [ -w ] [ -y ] [ --human ] [ --sadc ]\n"
+                         "[ -v ] [ -W ] [ -w ] [ -y ] [ --help ] [ --human ] [ --sadc ]\n"
                          "[ -I { <int_list> | SUM | ALL } ] [ -P { <cpu_list> | ALL } ]\n"
                          "[ -m { <keyword> [,...] | ALL } ] [ -n { <keyword> [,...] | ALL } ]\n"
                          "[ -j { ID | LABEL | PATH | UUID | ... } ]\n"
@@ -1225,6 +1225,11 @@ int main(int argc, char **argv)
                        which_sadc();
                }
 
+               else if (!strcmp(argv[opt], "--help")) {
+                       /* Display help message */
+                       display_help(argv[0]);
+               }
+
                else if (!strcmp(argv[opt], "--human")) {
                        /* Display sizes in a human readable format */
                        flags |= S_F_UNIT;
@@ -1299,11 +1304,6 @@ int main(int argc, char **argv)
                        }
                }
 
-               else if (!strcmp(argv[opt], "-h")) {
-                       /* Display help message */
-                       display_help(argv[0]);
-               }
-
                else if (!strcmp(argv[opt], "-i")) {
                        if (!argv[++opt] || (strspn(argv[opt], DIGITS) != strlen(argv[opt]))) {
                                usage(argv[0]);