[PATCH 8/8] lastlog2: besides -v, recognize also the standard -V for --version

Benno Schulenberg <[email protected]>
Newsgroups org.kernel.vger.util-linux
Message-ID <[email protected]>
The --help text already proclaimed that -V would work.

CC: Stefan Schubert <[email protected]>
Signed-off-by: Benno Schulenberg <[email protected]>
---
 misc-utils/lastlog2.8.adoc | 6 +-----
 misc-utils/lastlog2.c      | 5 +++--
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/misc-utils/lastlog2.8.adoc b/misc-utils/lastlog2.8.adoc
index e14e6b9cc..8a4b604ae 100644
--- a/misc-utils/lastlog2.8.adoc
+++ b/misc-utils/lastlog2.8.adoc
@@ -70,11 +70,7 @@ Print only last-login records more recent than _days_.
 *-u*, *--user* _login_::
 Print (or modify) the last-login record of the user _login_.
 
-*-h*, *--help*::
-Display help text and exit.
-
-*-v*, *--version*::
-Display version and exit.
+include::man-common/help-version.adoc[]
 
 == FILES
 
diff --git a/misc-utils/lastlog2.c b/misc-utils/lastlog2.c
index 91ba699cf..e973b5461 100644
--- a/misc-utils/lastlog2.c
+++ b/misc-utils/lastlog2.c
@@ -147,7 +147,7 @@ int main(int argc, char **argv)
 		{"set",      no_argument,       NULL, 'S'},
 		{"time",     required_argument, NULL, 't'},
 		{"user",     required_argument, NULL, 'u'},
-		{"version",  no_argument,       NULL, 'v'},
+		{"version",  no_argument,       NULL, 'V'},
 		{NULL, 0, NULL, '\0'}
 	};
 	char *error = NULL;
@@ -163,7 +163,7 @@ int main(int argc, char **argv)
 
 	int c;
 
-	while ((c = getopt_long(argc, argv, "ab:Cd:hi:r:sSt:u:v", longopts, NULL)) != -1) {
+	while ((c = getopt_long(argc, argv, "ab:Cd:hi:r:sSt:u:vV", longopts, NULL)) != -1) {
 		switch (c) {
 		case 'a': /* active; print lastlog excluding '**Never logged in**' users */
 			aflg = 1;
@@ -214,6 +214,7 @@ int main(int argc, char **argv)
 			uflg = 1;
 			user = optarg;
 			break;
+		case 'V':
 		case 'v': /* version; Print version number and exit */
 			print_version(EXIT_SUCCESS);
 			break;
-- 
2.48.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.