Annotation of src/usr.bin/finger/finger.h, Revision 1.8
1.8 ! millert 1: /* $OpenBSD: finger.h,v 1.7 2015/01/19 15:30:52 krw Exp $ */
1.1 deraadt 2: /*
3: * Copyright (c) 1989 The Regents of the University of California.
4: * All rights reserved.
5: *
6: * This code is derived from software contributed to Berkeley by
7: * Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
8: *
9: * Redistribution and use in source and binary forms, with or without
10: * modification, are permitted provided that the following conditions
11: * are met:
12: * 1. Redistributions of source code must retain the above copyright
13: * notice, this list of conditions and the following disclaimer.
14: * 2. Redistributions in binary form must reproduce the above copyright
15: * notice, this list of conditions and the following disclaimer in the
16: * documentation and/or other materials provided with the distribution.
1.4 millert 17: * 3. Neither the name of the University nor the names of its contributors
1.1 deraadt 18: * may be used to endorse or promote products derived from this software
19: * without specific prior written permission.
20: *
21: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31: * SUCH DAMAGE.
32: *
33: * from: @(#)finger.h 5.5 (Berkeley) 6/1/90
34: */
35:
36: #include <pwd.h>
37: #include <utmp.h>
38:
39: #define _PATH_MAILSPOOL "/var/mail"
1.8 ! millert 40:
! 41: #define SECSPERDAY (24 * 60 * 60)
! 42: #define SIXMONTHS (SECSPERDAY * 365 / 2)
1.1 deraadt 43:
44: /*
45: * All unique persons are linked in a list headed by "head" and linkd
46: * by the "next" field, as well as kept in a hash table.
47: */
48:
49: typedef struct person {
50: struct person *next; /* link to next person */
51: struct person *hlink; /* link to next person in hash bucket */
52: uid_t uid; /* user id */
53: char *dir; /* user's home directory */
54: char *homephone; /* pointer to home phone no. */
55: char *name; /* login name */
56: char *office; /* pointer to office name */
57: char *officephone; /* pointer to office phone no. */
58: char *realname; /* pointer to full name */
59: char *shell; /* user's shell */
60: time_t mailread; /* last time mail was read */
61: time_t mailrecv; /* last time mail was read */
62: struct where *whead, *wtail; /* list of where he is or has been */
63: } PERSON;
64:
65: enum status { LASTLOG, LOGGEDIN };
66:
67: typedef struct where {
68: struct where *next; /* next place he is or has been */
69: enum status info; /* type/status of request */
70: short writable; /* tty is writable */
71: time_t loginat; /* time of (last) login */
72: time_t idletime; /* how long idle (if logged in) */
73: char tty[UT_LINESIZE+1]; /* null terminated tty line */
74: char host[UT_HOSTSIZE+1]; /* null terminated remote host name */
75: } WHERE;
76:
77: #define HBITS 8 /* number of bits in hash code */
78: #define HSIZE (1 << 8) /* hash table size */
79: #define HMASK (HSIZE - 1) /* hash code mask */
80:
1.6 tedu 81: extern PERSON *htab[HSIZE]; /* the buckets */
82: extern PERSON *phead, *ptail; /* the linked list of all people */