From: Karel Zak Date: Tue, 13 Dec 2022 15:46:42 +0000 (+0100) Subject: chsh: add -V, update usage() X-Git-Tag: v2.39-rc1~369 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=13e58aa78d28d63fdef96cc988a05b8be3427bab;p=thirdparty%2Futil-linux.git chsh: add -V, update usage() * 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 --- diff --git a/login-utils/chsh.1.adoc b/login-utils/chsh.1.adoc index 939674ad50..965a9e333d 100644 --- a/login-utils/chsh.1.adoc +++ b/login-utils/chsh.1.adoc @@ -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 diff --git a/login-utils/chsh.c b/login-utils/chsh.c index eb02a72714..31750d558c 100644 --- a/login-utils/chsh.c +++ b/login-utils/chsh.c @@ -75,9 +75,10 @@ static void __attribute__((__noreturn__)) usage(void) fputs(USAGE_OPTIONS, fp); fputs(_(" -s, --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':