dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone

Blame SOURCES/0005-lslogins-add-info-about-single-user-output-mode.patch

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