|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1989 The Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * This code is derived from software contributed to Berkeley by ! 6: * Tony Nardo of the Johns Hopkins University/Applied Physics Lab. ! 7: * ! 8: * Redistribution and use in source and binary forms are permitted provided ! 9: * that: (1) source distributions retain this entire copyright notice and ! 10: * comment, and (2) distributions including binaries display the following ! 11: * acknowledgement: ``This product includes software developed by the ! 12: * University of California, Berkeley and its contributors'' in the ! 13: * documentation or other materials provided with the distribution and in ! 14: * all advertising materials mentioning features or use of this software. ! 15: * Neither the name of the University nor the names of its contributors may ! 16: * be used to endorse or promote products derived from this software without ! 17: * specific prior written permission. ! 18: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 19: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 20: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 21: * ! 22: * @(#)finger.h 5.5 (Berkeley) 6/1/90 ! 23: */ ! 24: ! 25: #include <pwd.h> ! 26: #include <utmp.h> ! 27: ! 28: /* ! 29: * All unique persons are linked in a list headed by "head" and linkd ! 30: * by the "next" field, as well as kept in a hash table. ! 31: */ ! 32: ! 33: typedef struct person { ! 34: struct person *next; /* link to next person */ ! 35: struct person *hlink; /* link to next person in hash bucket */ ! 36: uid_t uid; /* user id */ ! 37: char *dir; /* user's home directory */ ! 38: char *homephone; /* pointer to home phone no. */ ! 39: char *name; /* login name */ ! 40: char *office; /* pointer to office name */ ! 41: char *officephone; /* pointer to office phone no. */ ! 42: char *realname; /* pointer to full name */ ! 43: char *shell; /* user's shell */ ! 44: struct where *whead, *wtail; /* list of where he is or has been */ ! 45: } PERSON; ! 46: ! 47: enum status { LASTLOG, LOGGEDIN }; ! 48: ! 49: typedef struct where { ! 50: struct where *next; /* next place he is or has been */ ! 51: enum status info; /* type/status of request */ ! 52: short writable; /* tty is writable */ ! 53: time_t loginat; /* time of (last) login */ ! 54: time_t idletime; /* how long idle (if logged in) */ ! 55: char tty[UT_LINESIZE+1]; /* null terminated tty line */ ! 56: char host[UT_HOSTSIZE+1]; /* null terminated remote host name */ ! 57: } WHERE; ! 58: ! 59: #define HBITS 8 /* number of bits in hash code */ ! 60: #define HSIZE (1 << 8) /* hash table size */ ! 61: #define HMASK (HSIZE - 1) /* hash code mask */ ! 62: ! 63: PERSON *htab[HSIZE]; /* the buckets */ ! 64: PERSON *phead, *ptail; /* the linked list of all people */ ! 65: ! 66: int entries; /* number of people */ ! 67: ! 68: PERSON *enter_person(), *find_person(), *palloc(); ! 69: WHERE *walloc(); ! 70: ! 71: extern char tbuf[1024]; /* temp buffer for anybody */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.