]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
chfn: use -V for version
authorKarel Zak <kzak@redhat.com>
Tue, 13 Dec 2022 15:41:34 +0000 (16:41 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 13 Dec 2022 15:44:31 +0000 (16:44 +0100)
Let's use more compatible -V for --version and mark -v as deprecated.

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

index 6377e2644ba4e497de607d73b116808cd861e21b..35a2e82cf07233d8f482787312749caa028f3b83 100644 (file)
@@ -20,7 +20,7 @@ chfn - change your finger information
 
 == SYNOPSIS
 
-*chfn* [*-f* _full-name_] [*-o* _office_] [*-p* _office-phone_] [*-h* _home-phone_] [*-u*] [*-v*] [_username_]
+*chfn* [*-f* _full-name_] [*-o* _office_] [*-p* _office-phone_] [*-h* _home-phone_] [*-u*] [*-V*] [_username_]
 
 == DESCRIPTION
 
@@ -46,6 +46,13 @@ Specify your office phone number.
 *-h*, *--home-phone* _home-phone_::
 Specify your home phone number.
 
+*-u*, *--help*::
+Display help text and exit.
+
+*-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[]
 
 == CONFIG FILE ITEMS
index 8f00d156e32bddb10441f9a273400e1b14b4ffee..752d59821f2a577c855f86b00cea64fcf6d6d108 100644 (file)
@@ -100,7 +100,7 @@ static void __attribute__((__noreturn__)) usage(void)
        fputs(_(" -h, --home-phone <phone>     home phone number\n"), fp);
        fputs(USAGE_SEPARATOR, fp);
        printf( " -u, --help                   %s\n", USAGE_OPTSTR_HELP);
-       printf( " -v, --version                %s\n", USAGE_OPTSTR_VERSION);
+       printf( " -V, --version                %s\n", USAGE_OPTSTR_VERSION);
        printf(USAGE_MAN_TAIL("chfn(1)"));
        exit(EXIT_SUCCESS);
 }
@@ -139,11 +139,11 @@ static void parse_argv(struct chfn_control *ctl, int argc, char **argv)
                { "office-phone", required_argument, NULL, 'p' },
                { "home-phone",   required_argument, NULL, 'h' },
                { "help",         no_argument,       NULL, 'u' },
-               { "version",      no_argument,       NULL, 'v' },
+               { "version",      no_argument,       NULL, 'V' },
                { NULL, 0, NULL, 0 },
        };
 
-       while ((c = getopt_long(argc, argv, "f:r:p:h:o:uv", long_options,
+       while ((c = getopt_long(argc, argv, "f:r:p:h:o:uvV", long_options,
                                &index)) != -1) {
                switch (c) {
                case 'f':
@@ -170,7 +170,8 @@ static void parse_argv(struct chfn_control *ctl, int argc, char **argv)
                        ctl->newf.home_phone = optarg;
                        status += check_gecos_string(_("Home Phone"), optarg);
                        break;
-               case 'v':
+               case 'v': /* deprecated */
+               case 'V':
                        print_version(EXIT_SUCCESS);
                case 'u':
                        usage();