add -g flag: do not show non real name gecos info.

This commit is contained in:
mrg 1997-09-09 02:41:06 +00:00
parent 2db0ee4c18
commit 2703290213
5 changed files with 25 additions and 12 deletions

View File

@ -38,6 +38,7 @@ extern char tbuf[1024]; /* Temp buffer for anybody. */
extern int entries; /* Number of people. */
extern int lflag;
extern int oflag;
extern int gflag;
extern int pplan;
int demi_print __P((char *, int));

View File

@ -1,4 +1,4 @@
.\" $NetBSD: finger.1,v 1.7 1997/01/09 20:19:18 tls Exp $
.\" $NetBSD: finger.1,v 1.8 1997/09/09 02:41:07 mrg Exp $
.\"
.\" Copyright (c) 1989, 1990 The Regents of the University of California.
.\" All rights reserved.
@ -32,7 +32,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)finger.1 6.14 (Berkeley) 7/27/91
.\" $NetBSD: finger.1,v 1.7 1997/01/09 20:19:18 tls Exp $
.\" $NetBSD: finger.1,v 1.8 1997/09/09 02:41:07 mrg Exp $
.\"
.Dd November 21, 1996
.Dt FINGER 1
@ -42,7 +42,7 @@
.Nd user information lookup program
.Sh SYNOPSIS
.Nm finger
.Op Fl lmpsho
.Op Fl lmpshog
.Op Ar user ...
.Op Ar user@host ...
.Sh DESCRIPTION
@ -88,6 +88,9 @@ When used in conjunction with the
option, the office location and office phone information is displayed
instead of the name of the remote host.
.Pp
.It Fl g
This option restricts the gecos output to only the users' real names.
.Pp
.It Fl l
Produces a multi-line format displaying all of the information
described for the

View File

@ -1,4 +1,4 @@
/* $NetBSD: finger.c,v 1.7 1997/05/17 19:42:24 pk Exp $ */
/* $NetBSD: finger.c,v 1.8 1997/09/09 02:41:08 mrg Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@ -54,7 +54,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)finger.c 5.22 (Berkeley) 6/29/90";*/
static char rcsid[] = "$NetBSD: finger.c,v 1.7 1997/05/17 19:42:24 pk Exp $";
static char rcsid[] = "$NetBSD: finger.c,v 1.8 1997/09/09 02:41:08 mrg Exp $";
#endif /* not lint */
/*
@ -81,7 +81,7 @@ static char rcsid[] = "$NetBSD: finger.c,v 1.7 1997/05/17 19:42:24 pk Exp $";
#include "extern.h"
time_t now;
int entries, lflag, sflag, mflag, oflag, pplan;
int entries, lflag, sflag, mflag, oflag, gflag, pplan;
char tbuf[1024];
int
@ -94,7 +94,7 @@ main(argc, argv)
oflag = 1; /* default to old "office" behavior */
while ((ch = getopt(argc, argv, "lmpsho")) != EOF)
while ((ch = getopt(argc, argv, "lmpshog")) != EOF)
switch(ch) {
case 'l':
lflag = 1; /* long format */
@ -114,6 +114,9 @@ main(argc, argv)
case 'o':
oflag = 1; /* office info */
break;
case 'g':
gflag = 1; /* no gecos info, besides name */
break;
case '?':
default:
(void)fprintf(stderr,

View File

@ -1,4 +1,4 @@
/* $NetBSD: lprint.c,v 1.7 1997/01/09 20:19:22 tls Exp $ */
/* $NetBSD: lprint.c,v 1.8 1997/09/09 02:41:09 mrg Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@ -38,7 +38,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)lprint.c 5.13 (Berkeley) 10/31/90";*/
static char rcsid[] = "$NetBSD: lprint.c,v 1.7 1997/01/09 20:19:22 tls Exp $";
static char rcsid[] = "$NetBSD: lprint.c,v 1.8 1997/09/09 02:41:09 mrg Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -103,6 +103,8 @@ lprint(pn)
pn->name, pn->realname, pn->dir);
(void)printf("\tShell: %-s\n", *pn->shell ? pn->shell : _PATH_BSHELL);
if (gflag)
goto no_gecos;
/*
* try and print office, office phone, and home phone on one line;
* if that fails, do line filling so it looks nice.
@ -138,6 +140,7 @@ lprint(pn)
if (oddfield)
putchar('\n');
no_gecos:
/*
* long format con't:
* if logged in

View File

@ -1,4 +1,4 @@
/* $NetBSD: sprint.c,v 1.6 1997/03/28 02:15:21 mycroft Exp $ */
/* $NetBSD: sprint.c,v 1.7 1997/09/09 02:41:10 mrg Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@ -38,7 +38,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)sprint.c 5.8 (Berkeley) 12/4/90";*/
static char rcsid[] = "$NetBSD: sprint.c,v 1.6 1997/03/28 02:15:21 mycroft Exp $";
static char rcsid[] = "$NetBSD: sprint.c,v 1.7 1997/09/09 02:41:10 mrg Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -79,7 +79,7 @@ sflag_print()
#define MAXREALNAME 20
#define MAXHOSTNAME 20
(void)printf("%-*s %-*s %s %s\n", UT_NAMESIZE, "Login", MAXREALNAME,
"Name", "Tty Idle Login Time ",
"Name", "Tty Idle Login Time ", (gflag) ? "" :
(oflag) ? "Office Office Phone" : "Where");
for (cnt = 0; cnt < entries; ++cnt) {
pn = list[cnt];
@ -114,6 +114,8 @@ sflag_print()
else
(void)printf(" %.5s", p + 11);
office:
if (gflag)
goto no_gecos;
putchar(' ');
if (oflag) {
if (pn->office)
@ -125,6 +127,7 @@ office:
prphone(pn->officephone));
} else
(void)printf("%.*s", MAXHOSTNAME, w->host);
no_gecos:
putchar('\n');
}
}