]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
chsh: add -V, update usage()
authorKarel Zak <kzak@redhat.com>
Tue, 13 Dec 2022 15:46:42 +0000 (16:46 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 13 Dec 2022 15:52:52 +0000 (16:52 +0100)
* don't use deprecated -u in usage() (deprecated since 631a195412, v2.30)

* use -V for --version; deprecate -v

* add info about deprecated options to the man page

Addresses: https://github.com/util-linux/util-linux/pull/1954
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/chsh.1.adoc
login-utils/chsh.c

index 939674ad500dd5fb43b8f3c0ff5ebc7175dfe022..965a9e333d6818b50f7c578ce609ab3d52db76ed 100644 (file)
@@ -20,7 +20,7 @@ chsh - change your login shell
 
 == SYNOPSIS
 
-*chsh* [*-s* _shell_] [*-l*] [*-h*] [*-v*] [_username_]
+*chsh* [*-s* _shell_] [*-l*] [*-h*] [*-V*] [_username_]
 
 == DESCRIPTION
 
@@ -36,6 +36,14 @@ Specify your login shell.
 *-l*, *--list-shells*::
 Print the list of shells listed in _/etc/shells_ and exit.
 
+*-h*, *--help*::
+Display help text and exit. The short options *-h* have been used since version 2.30; old versions use
+deprecated *-u*.
+
+*-V*, *--version*::
+Print version and exit. The short options *-V* have been used since version 2.39; old versions use
+deprecated *-v*.
+
 include::man-common/help-version.adoc[]
 
 == VALID SHELLS
index eb02a7271421aeee8ef5c2562824d9d95785166f..31750d558c6abe58486808835216de702aa523c4 100644 (file)
@@ -75,9 +75,10 @@ static void __attribute__((__noreturn__)) usage(void)
        fputs(USAGE_OPTIONS, fp);
        fputs(_(" -s, --shell <shell>  specify login shell\n"), fp);
        fputs(_(" -l, --list-shells    print list of shells and exit\n"), fp);
+
        fputs(USAGE_SEPARATOR, fp);
-       printf( " -u, --help           %s\n", USAGE_OPTSTR_HELP);
-       printf( " -v, --version        %s\n", USAGE_OPTSTR_VERSION);
+       printf(USAGE_HELP_OPTIONS(22));
+
        printf(USAGE_MAN_TAIL("chsh(1)"));
        exit(EXIT_SUCCESS);
 }
@@ -105,14 +106,15 @@ static void parse_argv(int argc, char **argv, struct sinfo *pinfo)
                {"shell",       required_argument, NULL, 's'},
                {"list-shells", no_argument,       NULL, 'l'},
                {"help",        no_argument,       NULL, 'h'},
-               {"version",     no_argument,       NULL, 'v'},
+               {"version",     no_argument,       NULL, 'V'},
                {NULL, 0, NULL, 0},
        };
        int c;
 
-       while ((c = getopt_long(argc, argv, "s:lhuv", long_options, NULL)) != -1) {
+       while ((c = getopt_long(argc, argv, "s:lhuvV", long_options, NULL)) != -1) {
                switch (c) {
-               case 'v':
+               case 'v': /* deprecated */
+               case 'V':
                        print_version(EXIT_SUCCESS);
                case 'u': /* deprecated */
                case 'h':