summaryrefslogtreecommitdiffstats
path: root/usr.bin/finger/sprint.c
diff options
context:
space:
mode:
authormini <mini@FreeBSD.org>2002-07-02 08:00:20 +0000
committermini <mini@FreeBSD.org>2002-07-02 08:00:20 +0000
commit712f956e9e0dbe86568da5bc27fb0a75c38b84e1 (patch)
tree7246b8e210a907ac2095a88d0fe80e7eb1a1f7b9 /usr.bin/finger/sprint.c
parent3480b426f56630106d09d39b69abfba723b845df (diff)
downloadFreeBSD-src-712f956e9e0dbe86568da5bc27fb0a75c38b84e1.zip
FreeBSD-src-712f956e9e0dbe86568da5bc27fb0a75c38b84e1.tar.gz
Add -g option, which restricts printing of the gecos fields to just the user's
real name. PR: bin/39462 Submitted by: Mike Makonnen <makonnen@pacbell.net> Obtained from: NetBSD MFC after: 1 week
Diffstat (limited to 'usr.bin/finger/sprint.c')
-rw-r--r--usr.bin/finger/sprint.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/finger/sprint.c b/usr.bin/finger/sprint.c
index be7006e..b209b56 100644
--- a/usr.bin/finger/sprint.c
+++ b/usr.bin/finger/sprint.c
@@ -89,7 +89,7 @@ sflag_print()
#define MAXREALNAME 20
#define MAXHOSTNAME 17 /* in reality, hosts are never longer than 16 */
(void)printf("%-*s %-*s%s %s\n", UT_NAMESIZE, "Login", MAXREALNAME,
- "Name", " TTY Idle Login Time",
+ "Name", " TTY Idle Login Time ", (gflag) ? "" :
oflag ? "Office Phone" : "Where");
for (sflag = R_FIRST;; sflag = R_NEXT) {
@@ -143,7 +143,10 @@ sflag_print()
(void)strftime(p, sizeof(p), "%R", lc);
}
(void)printf(" %-5.5s", p);
-office: if (oflag) {
+office:
+ if (gflag)
+ goto no_gecos;
+ if (oflag) {
if (pn->office)
(void)printf(" %-7.7s", pn->office);
else if (pn->officephone)
@@ -153,6 +156,7 @@ office: if (oflag) {
prphone(pn->officephone));
} else
(void)printf(" %.*s", MAXHOSTNAME, w->host);
+no_gecos:
putchar('\n');
}
}
OpenPOWER on IntegriCloud