Commit | Line | Data |
---|---|---|
6b8910b8 KB |
1 | /* |
2 | * Copyright (c) 1989 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
f15db449 | 5 | * %sccs.include.redist.c% |
6b8910b8 | 6 | * |
f15db449 | 7 | * @(#)finger.h 5.5 (Berkeley) %G% |
6b8910b8 KB |
8 | */ |
9 | ||
10 | #include <pwd.h> | |
11 | #include <utmp.h> | |
12 | ||
7619ff47 EW |
13 | /* |
14 | * All unique persons are linked in a list headed by "head" and linkd | |
15 | * by the "next" field, as well as kept in a hash table. | |
16 | */ | |
17 | ||
6b8910b8 KB |
18 | typedef struct person { |
19 | struct person *next; /* link to next person */ | |
7619ff47 | 20 | struct person *hlink; /* link to next person in hash bucket */ |
6b8910b8 | 21 | uid_t uid; /* user id */ |
6b8910b8 KB |
22 | char *dir; /* user's home directory */ |
23 | char *homephone; /* pointer to home phone no. */ | |
24 | char *name; /* login name */ | |
25 | char *office; /* pointer to office name */ | |
26 | char *officephone; /* pointer to office phone no. */ | |
27 | char *realname; /* pointer to full name */ | |
28 | char *shell; /* user's shell */ | |
7619ff47 EW |
29 | struct where *whead, *wtail; /* list of where he is or has been */ |
30 | } PERSON; | |
31 | ||
32 | enum status { LASTLOG, LOGGEDIN }; | |
33 | ||
34 | typedef struct where { | |
35 | struct where *next; /* next place he is or has been */ | |
36 | enum status info; /* type/status of request */ | |
37 | short writable; /* tty is writable */ | |
38 | time_t loginat; /* time of (last) login */ | |
39 | time_t idletime; /* how long idle (if logged in) */ | |
6b8910b8 KB |
40 | char tty[UT_LINESIZE+1]; /* null terminated tty line */ |
41 | char host[UT_HOSTSIZE+1]; /* null terminated remote host name */ | |
7619ff47 EW |
42 | } WHERE; |
43 | ||
44 | #define HBITS 8 /* number of bits in hash code */ | |
45 | #define HSIZE (1 << 8) /* hash table size */ | |
46 | #define HMASK (HSIZE - 1) /* hash code mask */ | |
47 | ||
48 | PERSON *htab[HSIZE]; /* the buckets */ | |
49 | PERSON *phead, *ptail; /* the linked list of all people */ | |
50 | ||
51 | int entries; /* number of people */ | |
52 | ||
53 | PERSON *enter_person(), *find_person(), *palloc(); | |
54 | WHERE *walloc(); | |
6b8910b8 KB |
55 | |
56 | extern char tbuf[1024]; /* temp buffer for anybody */ |