Commit | Line | Data |
---|---|---|
6b8910b8 KB |
1 | /* |
2 | * Copyright (c) 1989 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
6b8910b8 KB |
5 | * Redistribution and use in source and binary forms are permitted |
6 | * provided that the above copyright notice and this paragraph are | |
7 | * duplicated in all such forms and that any documentation, | |
8 | * advertising materials, and other materials related to such | |
9 | * distribution and use acknowledge that the software was developed | |
10 | * by the University of California, Berkeley. The name of the | |
11 | * University may not be used to endorse or promote products derived | |
12 | * from this software without specific prior written permission. | |
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
15 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
16 | * | |
16c61828 | 17 | * @(#)finger.h 5.4 (Berkeley) %G% |
6b8910b8 KB |
18 | */ |
19 | ||
20 | #include <pwd.h> | |
21 | #include <utmp.h> | |
22 | ||
7619ff47 EW |
23 | /* |
24 | * All unique persons are linked in a list headed by "head" and linkd | |
25 | * by the "next" field, as well as kept in a hash table. | |
26 | */ | |
27 | ||
6b8910b8 KB |
28 | typedef struct person { |
29 | struct person *next; /* link to next person */ | |
7619ff47 | 30 | struct person *hlink; /* link to next person in hash bucket */ |
6b8910b8 | 31 | uid_t uid; /* user id */ |
6b8910b8 KB |
32 | char *dir; /* user's home directory */ |
33 | char *homephone; /* pointer to home phone no. */ | |
34 | char *name; /* login name */ | |
35 | char *office; /* pointer to office name */ | |
36 | char *officephone; /* pointer to office phone no. */ | |
37 | char *realname; /* pointer to full name */ | |
38 | char *shell; /* user's shell */ | |
7619ff47 EW |
39 | struct where *whead, *wtail; /* list of where he is or has been */ |
40 | } PERSON; | |
41 | ||
42 | enum status { LASTLOG, LOGGEDIN }; | |
43 | ||
44 | typedef struct where { | |
45 | struct where *next; /* next place he is or has been */ | |
46 | enum status info; /* type/status of request */ | |
47 | short writable; /* tty is writable */ | |
48 | time_t loginat; /* time of (last) login */ | |
49 | time_t idletime; /* how long idle (if logged in) */ | |
6b8910b8 KB |
50 | char tty[UT_LINESIZE+1]; /* null terminated tty line */ |
51 | char host[UT_HOSTSIZE+1]; /* null terminated remote host name */ | |
7619ff47 EW |
52 | } WHERE; |
53 | ||
54 | #define HBITS 8 /* number of bits in hash code */ | |
55 | #define HSIZE (1 << 8) /* hash table size */ | |
56 | #define HMASK (HSIZE - 1) /* hash code mask */ | |
57 | ||
58 | PERSON *htab[HSIZE]; /* the buckets */ | |
59 | PERSON *phead, *ptail; /* the linked list of all people */ | |
60 | ||
61 | int entries; /* number of people */ | |
62 | ||
63 | PERSON *enter_person(), *find_person(), *palloc(); | |
64 | WHERE *walloc(); | |
6b8910b8 KB |
65 | |
66 | extern char tbuf[1024]; /* temp buffer for anybody */ |