SCCS-vsn: usr.bin/finger/finger.c 5.12
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)finger.c 5.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)finger.c 5.12 (Berkeley) %G%";
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <lastlog.h>
-#include <ctype.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
+#include <utmp.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include "pathnames.h"
#define ASTERISK '*' /* ignore this in real name */
#define COMMA ',' /* separator in pw_gecos field */
#define ASTERISK '*' /* ignore this in real name */
#define COMMA ',' /* separator in pw_gecos field */
struct person *link; /* link to next person */
};
struct person *link; /* link to next person */
};
-char LASTLOG[] = "/usr/adm/lastlog"; /* last login info */
-char USERLOG[] = "/etc/utmp"; /* who is logged in */
char PLAN[] = "/.plan"; /* what plan file is */
char PROJ[] = "/.project"; /* what project file */
char PLAN[] = "/.plan"; /* what plan file is */
char PROJ[] = "/.project"; /* what project file */
int wide = 1; /* -w option default */
int unshort;
int wide = 1; /* -w option default */
int unshort;
-int lf; /* LASTLOG file descriptor */
+int lf; /* _PATH_LASTLOG file descriptor */
struct person *person1; /* list of people */
long tloc; /* current time */
struct person *person1; /* list of people */
long tloc; /* current time */
char name[NMAX + 1];
unshort = large;
char name[NMAX + 1];
unshort = large;
- if ((uf = open(USERLOG, 0)) < 0) {
- fprintf(stderr, "finger: error opening %s\n", USERLOG);
+ if ((uf = open(_PATH_UTMP, 0)) < 0) {
+ fprintf(stderr, "finger: error opening %s\n", _PATH_UTMP);
exit(2);
}
if (unquick) {
exit(2);
}
if (unquick) {
fwopen();
}
while (read(uf, (char *)&user, sizeof user) == sizeof user) {
fwopen();
}
while (read(uf, (char *)&user, sizeof user) == sizeof user) {
if (unquick) {
setpwent();
if (!match) {
if (unquick) {
setpwent();
if (!match) {
- extern _pw_stayopen;
-
- _pw_stayopen = 1;
for (p = person1; p != 0; p = p->link)
if (pw = getpwnam(p->name))
p->pwd = pwdcopy(pw);
for (p = person1; p != 0; p = p->link)
if (pw = getpwnam(p->name))
p->pwd = pwdcopy(pw);
endpwent();
}
/* Now get login information */
endpwent();
}
/* Now get login information */
- if ((uf = open(USERLOG, 0)) < 0) {
- fprintf(stderr, "finger: error opening %s\n", USERLOG);
+ if ((uf = open(_PATH_UTMP, 0)) < 0) {
+ fprintf(stderr, "finger: error opening %s\n", _PATH_UTMP);
exit(2);
}
while (read(uf, (char *)&user, sizeof user) == sizeof user) {
exit(2);
}
while (read(uf, (char *)&user, sizeof user) == sizeof user) {
- * find the last log in of a user by checking the LASTLOG file.
+ * find the last log in of a user by checking the _PATH_LASTLOG file.
* the entry is indexed by the uid, so this can only be done if
* the uid is known (which it isn't in quick mode)
*/
fwopen()
{
* the entry is indexed by the uid, so this can only be done if
* the uid is known (which it isn't in quick mode)
*/
fwopen()
{
- if ((lf = open(LASTLOG, 0)) < 0)
- fprintf(stderr, "finger: %s open error\n", LASTLOG);
+ if ((lf = open(_PATH_LASTLOG, 0)) < 0)
+ fprintf(stderr, "finger: %s open error\n", _PATH_LASTLOG);
} else {
if (i != 0)
fprintf(stderr, "finger: %s read error\n",
} else {
if (i != 0)
fprintf(stderr, "finger: %s read error\n",
pers->tty[0] = 0;
pers->host[0] = 0;
pers->loginat = 0L;
pers->tty[0] = 0;
pers->host[0] = 0;
pers->loginat = 0L;
/*
* find the idle time of a user by doing a stat on /dev/tty??,
/*
* find the idle time of a user by doing a stat on /dev/tty??,
- * where tty?? has been gotten from USERLOG, supposedly.
+ * where tty?? has been gotten from _PATH_UTMP, supposedly.
*/
findidle(pers)
register struct person *pers;
{
struct stat ttystatus;
*/
findidle(pers)
register struct person *pers;
{
struct stat ttystatus;
- static char buffer[20] = "/dev/";
+ static char buffer[20] = _PATH_DEV;