Merge from Lite2
This commit is contained in:
parent
18dac96b7b
commit
df3f5d9dd5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=23693
@ -41,7 +41,7 @@ static char copyright[] =
|
|||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)col.c 8.3 (Berkeley) 4/2/94";
|
static char sccsid[] = "@(#)col.c 8.5 (Berkeley) 5/4/95";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -49,6 +49,7 @@ static char sccsid[] = "@(#)col.c 8.3 (Berkeley) 4/2/94";
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
#define BS '\b' /* backspace */
|
#define BS '\b' /* backspace */
|
||||||
@ -299,6 +300,9 @@ main(argc, argv)
|
|||||||
l->l_max_col = cur_col;
|
l->l_max_col = cur_col;
|
||||||
cur_col++;
|
cur_col++;
|
||||||
}
|
}
|
||||||
|
if (max_line == 0)
|
||||||
|
exit(0); /* no lines, so just exit */
|
||||||
|
|
||||||
/* goto the last line that had a character on it */
|
/* goto the last line that had a character on it */
|
||||||
for (; l->l_next; l = l->l_next)
|
for (; l->l_next; l = l->l_next)
|
||||||
this_line++;
|
this_line++;
|
||||||
|
@ -41,7 +41,7 @@ static char copyright[] =
|
|||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)cut.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)cut.c 8.3 (Berkeley) 5/4/95";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -50,6 +50,7 @@ static char sccsid[] = "@(#)cut.c 8.1 (Berkeley) 6/6/93";
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
int cflag;
|
int cflag;
|
||||||
char dchar;
|
char dchar;
|
||||||
|
@ -38,11 +38,12 @@ static char copyright[] =
|
|||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)dirname.c 8.3 (Berkeley) 4/2/94";
|
static char sccsid[] = "@(#)dirname.c 8.4 (Berkeley) 5/4/95";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
void usage __P((void));
|
void usage __P((void));
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ static char copyright[] =
|
|||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)du.c 8.4 (Berkeley) 4/1/94";
|
static char sccsid[] = "@(#)du.c 8.5 (Berkeley) 5/4/95";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -54,6 +54,7 @@ static char sccsid[] = "@(#)du.c 8.4 (Berkeley) 4/1/94";
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
int linkchk __P((FTSENT *));
|
int linkchk __P((FTSENT *));
|
||||||
void usage __P((void));
|
void usage __P((void));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.\" Copyright (c) 1989, 1990, 1993
|
.\" Copyright (c) 1989, 1990, 1993, 1994
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
.\"
|
.\"
|
||||||
.\" Redistribution and use in source and binary forms, with or without
|
.\" Redistribution and use in source and binary forms, with or without
|
||||||
@ -29,9 +29,9 @@
|
|||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" @(#)finger.1 8.2 (Berkeley) 2/16/94
|
.\" @(#)finger.1 8.3 (Berkeley) 5/5/94
|
||||||
.\"
|
.\"
|
||||||
.Dd February 16, 1994
|
.Dd May 5, 1994
|
||||||
.Dt FINGER 1
|
.Dt FINGER 1
|
||||||
.Os BSD 4
|
.Os BSD 4
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -192,6 +192,11 @@ utilizes the following environment variable, if it exists:
|
|||||||
This variable may be set with favored options to
|
This variable may be set with favored options to
|
||||||
.Nm finger .
|
.Nm finger .
|
||||||
.El
|
.El
|
||||||
|
.Sh FILES
|
||||||
|
.Bl -tag -width /var/log/lastlog -compact
|
||||||
|
.It Pa /var/log/lastlog
|
||||||
|
last login data base
|
||||||
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr chpass 1 ,
|
.Xr chpass 1 ,
|
||||||
.Xr w 1 ,
|
.Xr w 1 ,
|
||||||
|
@ -51,7 +51,7 @@ static char copyright[] =
|
|||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)finger.c 8.2 (Berkeley) 9/30/93";
|
static char sccsid[] = "@(#)finger.c 8.5 (Berkeley) 5/4/95";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -69,16 +69,21 @@ static char sccsid[] = "@(#)finger.c 8.2 (Berkeley) 9/30/93";
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <time.h>
|
#include <db.h>
|
||||||
#include <pwd.h>
|
#include <err.h>
|
||||||
#include <utmp.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <pwd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <utmp.h>
|
||||||
#include <db.h>
|
#include <db.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
#include "finger.h"
|
#include "finger.h"
|
||||||
|
|
||||||
DB *db;
|
DB *db;
|
||||||
@ -185,7 +190,7 @@ main(argc, argv)
|
|||||||
lflag_print();
|
lflag_print();
|
||||||
else
|
else
|
||||||
sflag_print();
|
sflag_print();
|
||||||
exit(0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -199,7 +204,7 @@ loginlist()
|
|||||||
char name[UT_NAMESIZE + 1];
|
char name[UT_NAMESIZE + 1];
|
||||||
|
|
||||||
if (!freopen(_PATH_UTMP, "r", stdin))
|
if (!freopen(_PATH_UTMP, "r", stdin))
|
||||||
err("%s: %s", _PATH_UTMP, strerror(errno));
|
err(1, "%s", _PATH_UTMP);
|
||||||
name[UT_NAMESIZE] = NULL;
|
name[UT_NAMESIZE] = NULL;
|
||||||
while (fread((char *)&user, sizeof(user), 1, stdin) == 1) {
|
while (fread((char *)&user, sizeof(user), 1, stdin) == 1) {
|
||||||
if (!user.ut_name[0])
|
if (!user.ut_name[0])
|
||||||
@ -216,12 +221,15 @@ loginlist()
|
|||||||
}
|
}
|
||||||
if (db && lflag)
|
if (db && lflag)
|
||||||
for (sflag = R_FIRST;; sflag = R_NEXT) {
|
for (sflag = R_FIRST;; sflag = R_NEXT) {
|
||||||
|
PERSON *tmp;
|
||||||
|
|
||||||
r = (*db->seq)(db, &key, &data, sflag);
|
r = (*db->seq)(db, &key, &data, sflag);
|
||||||
if (r == -1)
|
if (r == -1)
|
||||||
err("db seq: %s", strerror(errno));
|
err(1, "db seq");
|
||||||
if (r == 1)
|
if (r == 1)
|
||||||
break;
|
break;
|
||||||
enter_lastlog(*(PERSON **)data.data);
|
memmove(&tmp, data.data, sizeof tmp);
|
||||||
|
enter_lastlog(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +247,7 @@ userlist(argc, argv)
|
|||||||
|
|
||||||
if ((nargv = malloc((argc+1) * sizeof(char *))) == NULL ||
|
if ((nargv = malloc((argc+1) * sizeof(char *))) == NULL ||
|
||||||
(used = calloc(argc, sizeof(int))) == NULL)
|
(used = calloc(argc, sizeof(int))) == NULL)
|
||||||
err("%s", strerror(errno));
|
err(1, NULL);
|
||||||
|
|
||||||
/* Pull out all network requests. */
|
/* Pull out all network requests. */
|
||||||
for (ap = p = argv, np = nargv; *p; ++p)
|
for (ap = p = argv, np = nargv; *p; ++p)
|
||||||
@ -260,13 +268,13 @@ userlist(argc, argv)
|
|||||||
*/
|
*/
|
||||||
if (mflag)
|
if (mflag)
|
||||||
for (p = argv; *p; ++p)
|
for (p = argv; *p; ++p)
|
||||||
if ((pw = getpwnam(*p)) && !hide(pw))
|
if (((pw = getpwnam(*p)) != NULL) && !hide(pw))
|
||||||
enter_person(pw);
|
enter_person(pw);
|
||||||
else
|
else
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"finger: %s: no such user\n", *p);
|
"finger: %s: no such user\n", *p);
|
||||||
else {
|
else {
|
||||||
while (pw = getpwent()) {
|
while ((pw = getpwent()) != NULL) {
|
||||||
for (p = argv, ip = used; *p; ++p, ++ip)
|
for (p = argv, ip = used; *p; ++p, ++ip)
|
||||||
if (match(pw, *p) && !hide(pw)) {
|
if (match(pw, *p) && !hide(pw)) {
|
||||||
enter_person(pw);
|
enter_person(pw);
|
||||||
@ -294,7 +302,7 @@ net: for (p = nargv; *p;) {
|
|||||||
* appropriate data whenever a match occurs.
|
* appropriate data whenever a match occurs.
|
||||||
*/
|
*/
|
||||||
if (!freopen(_PATH_UTMP, "r", stdin))
|
if (!freopen(_PATH_UTMP, "r", stdin))
|
||||||
err("%s: %s", _PATH_UTMP, strerror(errno));
|
err(1, "%s", _PATH_UTMP);
|
||||||
while (fread((char *)&user, sizeof(user), 1, stdin) == 1) {
|
while (fread((char *)&user, sizeof(user), 1, stdin) == 1) {
|
||||||
if (!user.ut_name[0])
|
if (!user.ut_name[0])
|
||||||
continue;
|
continue;
|
||||||
@ -304,11 +312,14 @@ net: for (p = nargv; *p;) {
|
|||||||
}
|
}
|
||||||
if (db)
|
if (db)
|
||||||
for (sflag = R_FIRST;; sflag = R_NEXT) {
|
for (sflag = R_FIRST;; sflag = R_NEXT) {
|
||||||
|
PERSON *tmp;
|
||||||
|
|
||||||
r = (*db->seq)(db, &key, &data, sflag);
|
r = (*db->seq)(db, &key, &data, sflag);
|
||||||
if (r == -1)
|
if (r == -1)
|
||||||
err("db seq: %s", strerror(errno));
|
err(1, "db seq");
|
||||||
if (r == 1)
|
if (r == 1)
|
||||||
break;
|
break;
|
||||||
enter_lastlog(*(PERSON **)data.data);
|
memmove(&tmp, data.data, sizeof tmp);
|
||||||
|
enter_lastlog(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)lprint.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)lprint.c 8.3 (Berkeley) 4/28/95";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -44,6 +44,7 @@ static char sccsid[] = "@(#)lprint.c 8.1 (Berkeley) 6/6/93";
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <db.h>
|
#include <db.h>
|
||||||
|
#include <err.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -71,15 +72,17 @@ lflag_print()
|
|||||||
extern int pplan;
|
extern int pplan;
|
||||||
register PERSON *pn;
|
register PERSON *pn;
|
||||||
register int sflag, r;
|
register int sflag, r;
|
||||||
|
PERSON *tmp;
|
||||||
DBT data, key;
|
DBT data, key;
|
||||||
|
|
||||||
for (sflag = R_FIRST;; sflag = R_NEXT) {
|
for (sflag = R_FIRST;; sflag = R_NEXT) {
|
||||||
r = (*db->seq)(db, &key, &data, sflag);
|
r = (*db->seq)(db, &key, &data, sflag);
|
||||||
if (r == -1)
|
if (r == -1)
|
||||||
err("db seq: %s", strerror(errno));
|
err(1, "db seq");
|
||||||
if (r == 1)
|
if (r == 1)
|
||||||
break;
|
break;
|
||||||
pn = *(PERSON **)data.data;
|
memmove(&tmp, data.data, sizeof tmp);
|
||||||
|
pn = tmp;
|
||||||
if (sflag != R_FIRST)
|
if (sflag != R_FIRST)
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
lprint(pn);
|
lprint(pn);
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)net.c 8.3 (Berkeley) 1/2/94";
|
static char sccsid[] = "@(#)net.c 8.4 (Berkeley) 4/28/95";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -144,9 +144,8 @@ netfinger(name)
|
|||||||
* it isn't a space, we can simply set the 7th bit. Every ASCII
|
* it isn't a space, we can simply set the 7th bit. Every ASCII
|
||||||
* character with bit 7 set is printable.
|
* character with bit 7 set is printable.
|
||||||
*/
|
*/
|
||||||
if (fp = fdopen(s, "r")) {
|
lastc = 0;
|
||||||
int lastc = '\n';
|
if ((fp = fdopen(s, "r")) != NULL) {
|
||||||
|
|
||||||
while ((c = getc(fp)) != EOF) {
|
while ((c = getc(fp)) != EOF) {
|
||||||
if (c == 0x0d) {
|
if (c == 0x0d) {
|
||||||
if (lastc == '\r') /* ^M^M - skip dupes */
|
if (lastc == '\r') /* ^M^M - skip dupes */
|
||||||
|
@ -35,13 +35,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)sprint.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)sprint.c 8.3 (Berkeley) 4/28/95";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <db.h>
|
#include <db.h>
|
||||||
|
#include <err.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
@ -61,6 +62,7 @@ sflag_print()
|
|||||||
register WHERE *w;
|
register WHERE *w;
|
||||||
register int sflag, r, namelen;
|
register int sflag, r, namelen;
|
||||||
char p[80];
|
char p[80];
|
||||||
|
PERSON *tmp;
|
||||||
DBT data, key;
|
DBT data, key;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -88,10 +90,11 @@ sflag_print()
|
|||||||
for (sflag = R_FIRST;; sflag = R_NEXT) {
|
for (sflag = R_FIRST;; sflag = R_NEXT) {
|
||||||
r = (*db->seq)(db, &key, &data, sflag);
|
r = (*db->seq)(db, &key, &data, sflag);
|
||||||
if (r == -1)
|
if (r == -1)
|
||||||
err("db seq: %s", strerror(errno));
|
err(1, "db seq");
|
||||||
if (r == 1)
|
if (r == 1)
|
||||||
break;
|
break;
|
||||||
pn = *(PERSON **)data.data;
|
memmove(&tmp, data.data, sizeof tmp);
|
||||||
|
pn = tmp;
|
||||||
|
|
||||||
for (w = pn->whead; w != NULL; w = w->next) {
|
for (w = pn->whead; w != NULL; w = w->next) {
|
||||||
namelen = MAXREALNAME;
|
namelen = MAXREALNAME;
|
||||||
|
@ -35,13 +35,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)util.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)util.c 8.3 (Berkeley) 4/28/95";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <db.h>
|
#include <db.h>
|
||||||
|
#include <err.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -81,14 +82,14 @@ match(pw, user)
|
|||||||
if ((p = strtok(p, ",")) == NULL)
|
if ((p = strtok(p, ",")) == NULL)
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
for (t = name; *t = *p; ++p)
|
for (t = name; (*t = *p) != '\0'; ++p)
|
||||||
if (*t == '&') {
|
if (*t == '&') {
|
||||||
(void)strcpy(t, pw->pw_name);
|
(void)strcpy(t, pw->pw_name);
|
||||||
while (*++t);
|
while (*++t);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
++t;
|
++t;
|
||||||
for (t = name; p = strtok(t, "\t "); t = NULL)
|
for (t = name; (p = strtok(t, "\t ")) != NULL; t = NULL)
|
||||||
if (!strcasecmp(p, user))
|
if (!strcasecmp(p, user))
|
||||||
return(1);
|
return(1);
|
||||||
return(0);
|
return(0);
|
||||||
@ -170,17 +171,18 @@ enter_person(pw)
|
|||||||
|
|
||||||
if (db == NULL &&
|
if (db == NULL &&
|
||||||
(db = dbopen(NULL, O_RDWR, 0, DB_BTREE, NULL)) == NULL)
|
(db = dbopen(NULL, O_RDWR, 0, DB_BTREE, NULL)) == NULL)
|
||||||
err("%s", strerror(errno));
|
err(1, NULL);
|
||||||
|
|
||||||
key.data = pw->pw_name;
|
key.data = pw->pw_name;
|
||||||
key.size = strlen(pw->pw_name);
|
key.size = strlen(pw->pw_name);
|
||||||
|
|
||||||
switch((*db->get)(db, &key, &data, 0)) {
|
switch ((*db->get)(db, &key, &data, 0)) {
|
||||||
case 0:
|
case 0:
|
||||||
return(*(PERSON **)data.data);
|
memmove(&pn, data.data, sizeof pn);
|
||||||
|
return (pn);
|
||||||
default:
|
default:
|
||||||
case -1:
|
case -1:
|
||||||
err("db get: %s", strerror(errno));
|
err(1, "db get");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
case 1:
|
case 1:
|
||||||
++entries;
|
++entries;
|
||||||
@ -191,8 +193,8 @@ enter_person(pw)
|
|||||||
data.size = sizeof(PERSON *);
|
data.size = sizeof(PERSON *);
|
||||||
data.data = &pn;
|
data.data = &pn;
|
||||||
if ((*db->put)(db, &key, &data, 0))
|
if ((*db->put)(db, &key, &data, 0))
|
||||||
err("%s", strerror(errno));
|
err(1, "db put");
|
||||||
return(pn);
|
return (pn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,6 +206,7 @@ find_person(name)
|
|||||||
|
|
||||||
register int cnt;
|
register int cnt;
|
||||||
DBT data, key;
|
DBT data, key;
|
||||||
|
PERSON *p;
|
||||||
char buf[UT_NAMESIZE + 1];
|
char buf[UT_NAMESIZE + 1];
|
||||||
|
|
||||||
if (!db)
|
if (!db)
|
||||||
@ -219,7 +222,10 @@ find_person(name)
|
|||||||
key.data = buf;
|
key.data = buf;
|
||||||
key.size = cnt;
|
key.size = cnt;
|
||||||
|
|
||||||
return((*db->get)(db, &key, &data, 0) ? NULL : *(PERSON **)data.data);
|
if ((*db->get)(db, &key, &data, 0))
|
||||||
|
return (NULL);
|
||||||
|
memmove(&p, data.data, sizeof p);
|
||||||
|
return (p);
|
||||||
}
|
}
|
||||||
|
|
||||||
PERSON *
|
PERSON *
|
||||||
@ -228,7 +234,7 @@ palloc()
|
|||||||
PERSON *p;
|
PERSON *p;
|
||||||
|
|
||||||
if ((p = malloc((u_int) sizeof(PERSON))) == NULL)
|
if ((p = malloc((u_int) sizeof(PERSON))) == NULL)
|
||||||
err("%s", strerror(errno));
|
err(1, NULL);
|
||||||
return(p);
|
return(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +245,7 @@ walloc(pn)
|
|||||||
register WHERE *w;
|
register WHERE *w;
|
||||||
|
|
||||||
if ((w = malloc((u_int) sizeof(WHERE))) == NULL)
|
if ((w = malloc((u_int) sizeof(WHERE))) == NULL)
|
||||||
err("%s", strerror(errno));
|
err(1, NULL);
|
||||||
if (pn->whead == NULL)
|
if (pn->whead == NULL)
|
||||||
pn->whead = pn->wtail = w;
|
pn->whead = pn->wtail = w;
|
||||||
else {
|
else {
|
||||||
@ -309,8 +315,7 @@ find_idle_and_ttywrite(w)
|
|||||||
|
|
||||||
(void)snprintf(tbuf, sizeof(tbuf), "%s/%s", _PATH_DEV, w->tty);
|
(void)snprintf(tbuf, sizeof(tbuf), "%s/%s", _PATH_DEV, w->tty);
|
||||||
if (stat(tbuf, &sb) < 0) {
|
if (stat(tbuf, &sb) < 0) {
|
||||||
(void)fprintf(stderr,
|
warn(tbuf);
|
||||||
"finger: %s: %s\n", tbuf, strerror(errno));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
w->idletime = now < sb.st_atime ? 0 : now - sb.st_atime;
|
w->idletime = now < sb.st_atime ? 0 : now - sb.st_atime;
|
||||||
@ -343,7 +348,7 @@ userinfo(pn, pw)
|
|||||||
/* ampersands get replaced by the login name */
|
/* ampersands get replaced by the login name */
|
||||||
if (!(p = strsep(&bp, ",")))
|
if (!(p = strsep(&bp, ",")))
|
||||||
return;
|
return;
|
||||||
for (t = name; *t = *p; ++p)
|
for (t = name; (*t = *p) != '\0'; ++p)
|
||||||
if (*t == '&') {
|
if (*t == '&') {
|
||||||
(void)strcpy(t, pw->pw_name);
|
(void)strcpy(t, pw->pw_name);
|
||||||
if (islower(*t))
|
if (islower(*t))
|
||||||
@ -373,35 +378,6 @@ userinfo(pn, pw)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __STDC__
|
|
||||||
#include <stdarg.h>
|
|
||||||
#else
|
|
||||||
#include <varargs.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
|
||||||
#if __STDC__
|
|
||||||
err(const char *fmt, ...)
|
|
||||||
#else
|
|
||||||
err(fmt, va_alist)
|
|
||||||
char *fmt;
|
|
||||||
va_dcl
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
#if __STDC__
|
|
||||||
va_start(ap, fmt);
|
|
||||||
#else
|
|
||||||
va_start(ap);
|
|
||||||
#endif
|
|
||||||
(void)fprintf(stderr, "finger: ");
|
|
||||||
(void)vfprintf(stderr, fmt, ap);
|
|
||||||
va_end(ap);
|
|
||||||
(void)fprintf(stderr, "\n");
|
|
||||||
exit(1);
|
|
||||||
/* NOTREACHED */
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is this user hiding from finger?
|
* Is this user hiding from finger?
|
||||||
* If ~<user>/.nofinger exists, return 1 (hide), else return 0 (nohide).
|
* If ~<user>/.nofinger exists, return 1 (hide), else return 0 (nohide).
|
||||||
|
@ -38,7 +38,7 @@ static char copyright[] =
|
|||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)fstat.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)fstat.c 8.3 (Berkeley) 5/2/95";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -65,7 +65,9 @@ static char sccsid[] = "@(#)fstat.c 8.1 (Berkeley) 6/6/93";
|
|||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <nfs/nfsproto.h>
|
#include <nfs/nfsproto.h>
|
||||||
#include <nfs/rpcv2.h>
|
#include <nfs/rpcv2.h>
|
||||||
|
#define KERNEL
|
||||||
#include <nfs/nfs.h>
|
#include <nfs/nfs.h>
|
||||||
|
#undef KERNEL
|
||||||
#include <nfs/nfsnode.h>
|
#include <nfs/nfsnode.h>
|
||||||
#undef NFS
|
#undef NFS
|
||||||
|
|
||||||
@ -79,12 +81,14 @@ static char sccsid[] = "@(#)fstat.c 8.1 (Berkeley) 6/6/93";
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <kvm.h>
|
#include <kvm.h>
|
||||||
|
#include <limits.h>
|
||||||
#include <nlist.h>
|
#include <nlist.h>
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#define TEXT -1
|
#define TEXT -1
|
||||||
#define CDIR -2
|
#define CDIR -2
|
||||||
@ -164,6 +168,7 @@ main(argc, argv)
|
|||||||
struct kinfo_proc *p, *plast;
|
struct kinfo_proc *p, *plast;
|
||||||
int arg, ch, what;
|
int arg, ch, what;
|
||||||
char *memf, *nlistf;
|
char *memf, *nlistf;
|
||||||
|
char buf[_POSIX2_LINE_MAX];
|
||||||
int cnt;
|
int cnt;
|
||||||
|
|
||||||
arg = 0;
|
arg = 0;
|
||||||
@ -238,8 +243,8 @@ main(argc, argv)
|
|||||||
if (nlistf != NULL || memf != NULL)
|
if (nlistf != NULL || memf != NULL)
|
||||||
setgid(getgid());
|
setgid(getgid());
|
||||||
|
|
||||||
if ((kd = kvm_open(nlistf, memf, NULL, O_RDONLY, NULL)) == NULL) {
|
if ((kd = kvm_openfiles(nlistf, memf, NULL, O_RDONLY, buf)) == NULL) {
|
||||||
fprintf(stderr, "fstat: %s\n", kvm_geterr(kd));
|
fprintf(stderr, "fstat: %s\n", buf);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#ifdef notdef
|
#ifdef notdef
|
||||||
|
@ -38,15 +38,17 @@ static char copyright[] =
|
|||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)head.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)head.c 8.2 (Berkeley) 5/4/95";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <unistd.h>
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* head - give the first few lines of a stream or of each of a set of files
|
* head - give the first few lines of a stream or of each of a set of files
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)hexsyntax.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)hexsyntax.c 8.2 (Berkeley) 5/4/95";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -40,6 +40,8 @@ static char sccsid[] = "@(#)hexsyntax.c 8.1 (Berkeley) 6/6/93";
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "hexdump.h"
|
#include "hexdump.h"
|
||||||
|
|
||||||
off_t skip; /* bytes to skip */
|
off_t skip; /* bytes to skip */
|
||||||
|
@ -32,14 +32,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)odsyntax.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)odsyntax.c 8.2 (Berkeley) 5/4/95";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "hexdump.h"
|
#include "hexdump.h"
|
||||||
|
|
||||||
int deprecated;
|
int deprecated;
|
||||||
|
@ -41,7 +41,7 @@ static char copyright[] =
|
|||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)look.c 8.1 (Berkeley) 6/14/93";
|
static char sccsid[] = "@(#)look.c 8.2 (Berkeley) 5/4/95";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -58,12 +58,15 @@ static char sccsid[] = "@(#)look.c 8.1 (Berkeley) 6/14/93";
|
|||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "pathnames.h"
|
#include "pathnames.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -38,7 +38,7 @@ static char copyright[] =
|
|||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)mt.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)mt.c 8.2 (Berkeley) 5/4/95";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -48,12 +48,14 @@ static char sccsid[] = "@(#)mt.c 8.1 (Berkeley) 6/6/93";
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/mtio.h>
|
#include <sys/mtio.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
/* the appropriate sections of <sys/mtio.h> are also #ifdef'd for FreeBSD */
|
/* the appropriate sections of <sys/mtio.h> are also #ifdef'd for FreeBSD */
|
||||||
#if defined(__FreeBSD__)
|
#if defined(__FreeBSD__)
|
||||||
|
@ -38,14 +38,17 @@ static char copyright[] =
|
|||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "@(#)tr.c 8.1 (Berkeley) 6/6/93";
|
static char sccsid[] = "@(#)tr.c 8.2 (Berkeley) 5/4/95";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
|
||||||
static int string1[NCHARS] = {
|
static int string1[NCHARS] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user