069435
From e73085fe74356df96b0e694c906f22f9c71a56c7 Mon Sep 17 00:00:00 2001
069435
From: Karel Zak <kzak@redhat.com>
069435
Date: Mon, 13 Aug 2018 13:49:26 +0200
069435
Subject: [PATCH 5/6] lslogins: add info about single-user output mode
069435
069435
The supported command line synopsis is also
069435
069435
	lslogins foo
069435
069435
and it provides different output than
069435
069435
	lslogins -l foo
069435
069435
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1614967
069435
Signed-off-by: Karel Zak <kzak@redhat.com>
069435
---
069435
 login-utils/lslogins.1 | 11 ++++++++++-
069435
 login-utils/lslogins.c |  2 +-
069435
 2 files changed, 11 insertions(+), 2 deletions(-)
069435
069435
diff --git a/login-utils/lslogins.1 b/login-utils/lslogins.1
069435
index bd6955f82..effd42790 100644
069435
--- a/login-utils/lslogins.1
069435
+++ b/login-utils/lslogins.1
069435
@@ -9,10 +9,17 @@ lslogins \- display information about known users in the system
069435
 .RB [ \-s | \-u [ =\fIUID ]]
069435
 .RB [ \-g " \fIgroups\fR]"
069435
 .RB [ \-l " \fIlogins\fR]"
069435
+.RB [\fIusername\fR]
069435
 .SH DESCRIPTION
069435
 .PP
069435
 Examine the wtmp and btmp logs, /etc/shadow (if necessary) and /etc/passwd
069435
 and output the desired data.
069435
+
069435
+The optional argument \fIusername\fR forces
069435
+.BR lslogins
069435
+to print all available details about the specified user only. In this case the
069435
+output format is different than in case of \fB\-l\fR or \fB\-g\fR.
069435
+
069435
 .PP
069435
 The default action is to list info about all the users in the system.
069435
 .SH OPTIONS
069435
@@ -39,7 +46,8 @@ Show information about supplementary groups.
069435
 .TP
069435
 \fB\-g\fR, \fB\-\-groups\fR=\fIgroups\fR
069435
 Only show data of users belonging to \fIgroups\fR.  More than one group
069435
-may be specified; the list has to be comma-separated.
069435
+may be specified; the list has to be comma-separated.  The unknown group
069435
+names are ignored.
069435
 
069435
 Note that relation between user and group may be invisible for primary group if
069435
 the user is not explicitly specify as group member (e.g. in /etc/group). If the
069435
@@ -55,6 +63,7 @@ Display data containing information about the users' last login sessions.
069435
 \fB\-l\fR, \fB\-\-logins\fR=\fIlogins\fR
069435
 Only show data of users with a login specified in \fIlogins\fR (user names or user
069435
 IDS).  More than one login may be specified; the list has to be comma-separated.
069435
+The unknown login names are ignored.
069435
 .TP
069435
 \fB\-n\fR, \fB\-\-newline\fR
069435
 Display each piece of information on a separate line.
069435
diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c
069435
index 169962b72..501778e54 100644
069435
--- a/login-utils/lslogins.c
069435
+++ b/login-utils/lslogins.c
069435
@@ -1293,7 +1293,7 @@ static void __attribute__((__noreturn__)) usage(void)
069435
 	size_t i;
069435
 
069435
 	fputs(USAGE_HEADER, out);
069435
-	fprintf(out, _(" %s [options]\n"), program_invocation_short_name);
069435
+	fprintf(out, _(" %s [options] [<username>]\n"), program_invocation_short_name);
069435
 
069435
 	fputs(USAGE_SEPARATOR, out);
069435
 	fputs(_("Display information about known users in the system.\n"), out);
069435
-- 
069435
2.14.4
069435