From ea5df5a2fdbfc8e78f98d93c6e9f5eb90f167ae4 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 14 Apr 2025 11:45:34 +0200 Subject: [PATCH] lastlog2: besides -v, recognize also the standard -V for --version The --help text already proclaimed that -V would work. CC: Stefan Schubert Signed-off-by: Benno Schulenberg --- 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 6471cae1c..4857cfdce 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.47.2