Add code to keep going if you're really intent on fingering someone, but

can't use utmp(5).
This commit is contained in:
Juli Mallett 2003-06-28 23:11:41 +00:00
parent 73e57b801f
commit ad46866975
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=117010
2 changed files with 16 additions and 4 deletions

View File

@ -40,7 +40,7 @@
.Nd user information lookup program
.Sh SYNOPSIS
.Nm
.Op Fl 46glmpshoT
.Op Fl 46gklmpshoT
.Op Ar user ...\&
.Op Ar user@host ...\&
.Sh DESCRIPTION
@ -98,6 +98,9 @@ name. It also has the side-effect of restricting the output
of the remote host when used in conjunction with the
.Fl h
option.
.It Fl k
Disable all use of
.Xr utmp 5 .
.It Fl l
Produce a multi-line format displaying all of the information
described for the

View File

@ -91,7 +91,7 @@ __FBSDID("$FreeBSD$");
DB *db;
time_t now;
int entries, gflag, lflag, mflag, pplan, sflag, oflag, Tflag;
int entries, gflag, kflag, lflag, mflag, pplan, sflag, oflag, Tflag;
sa_family_t family = PF_UNSPEC;
int d_first = -1;
char tbuf[1024];
@ -108,7 +108,7 @@ option(int argc, char **argv)
optind = 1; /* reset getopt */
while ((ch = getopt(argc, argv, "46glmpshoT")) != -1)
while ((ch = getopt(argc, argv, "46gklmpshoT")) != -1)
switch(ch) {
case '4':
family = AF_INET;
@ -119,6 +119,9 @@ option(int argc, char **argv)
case 'g':
gflag = 1;
break;
case 'k':
kflag = 1; /* keep going without utmp */
break;
case 'l':
lflag = 1; /* long format */
break;
@ -151,7 +154,7 @@ option(int argc, char **argv)
static void
usage(void)
{
(void)fprintf(stderr, "usage: finger [-46lmpshoT] [login ...]\n");
(void)fprintf(stderr, "usage: finger [-46klmpshoT] [login ...]\n");
exit(1);
}
@ -234,6 +237,9 @@ loginlist(void)
int r, sflag1;
char name[UT_NAMESIZE + 1];
if (kflag)
errx(1, "can't list logins without reading utmp");
if (!freopen(_PATH_UTMP, "r", stdin))
err(1, "%s", _PATH_UTMP);
name[UT_NAMESIZE] = '\0';
@ -370,6 +376,9 @@ net: for (p = nargv; *p;) {
if (entries == 0)
return;
if (kflag)
return;
/*
* Scan thru the list of users currently logged in, saving
* appropriate data whenever a match occurs.