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

Defined variables

htab defined in line 61; used 2 times
ptail defined in line 62; used 3 times

Defined struct's

person defined in line 31; used 4 times
where defined in line 47; used 3 times

Defined enum's

status defined in line 45; used 2 times
  • in line 49(2)

Defined typedef's

PERSON defined in line 43; used 29 times
WHERE defined in line 55; used 11 times

Defined macros

HBITS defined in line 57; used 1 times
HMASK defined in line 59; used 1 times
HSIZE defined in line 58; used 2 times

Usage of this include

Last modified: 1990-03-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2841
Valid CSS Valid XHTML 1.0 Strict