]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
login: add version printing option
authorSami Kerola <kerolasa@iki.fi>
Sun, 13 Nov 2011 16:14:51 +0000 (17:14 +0100)
committerSami Kerola <kerolasa@iki.fi>
Wed, 23 Nov 2011 20:37:19 +0000 (21:37 +0100)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
login-utils/login.1
login-utils/login.c

index 93ab82c91fe9b0e9e3fdeb0aa57fb99642b19e9c..d5d372d88bdc8347ead3f6f747bc6a6d49d0b78c 100644 (file)
@@ -122,6 +122,9 @@ Used by other servers (i.e.,
 to tell
 .B login
 that printing the hostname should be suppressed in the login: prompt.
+.TP
+.B \-V
+Print version and exit.
 
 .SH CONFIG FILE ITEMS
 .B login
index 0024055554e51266d7c75119281a51892d65c45d..e80b137ba3f3978b44a8f8c74dd31f6266e88b63 100644 (file)
@@ -1241,7 +1241,7 @@ int main(int argc, char **argv)
         * -h is used by other servers to pass the name of the remote
         *    host to login so that it may be placed in utmp and wtmp
         */
-       while ((c = getopt(argc, argv, "fHh:p")) != -1)
+       while ((c = getopt(argc, argv, "fHh:pV")) != -1)
                switch (c) {
                case 'f':
                        cxt.noauth = 1;
@@ -1264,6 +1264,9 @@ int main(int argc, char **argv)
                        cxt.keep_env = 1;
                        break;
 
+               case 'V':
+                       printf(UTIL_LINUX_VERSION);
+                       return EXIT_SUCCESS;
                case '?':
                default:
                        fprintf(stderr, _("usage: login [ -p ] [ -h host ] [ -H ] [ -f username | username ]\n"));