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