[BACK]Return to finger.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / finger

Annotation of src/usr.bin/finger/finger.h, Revision 1.4

1.4     ! millert     1: /* *   $OpenBSD: finger.h,v 1.3 1997/05/30 23:35:51 kstailey 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"
                     40:
                     41: /*
                     42:  * All unique persons are linked in a list headed by "head" and linkd
                     43:  * by the "next" field, as well as kept in a hash table.
                     44:  */
                     45:
                     46: typedef struct person {
                     47:        struct person *next;            /* link to next person */
                     48:        struct person *hlink;           /* link to next person in hash bucket */
                     49:        uid_t uid;                      /* user id */
                     50:        char *dir;                      /* user's home directory */
                     51:        char *homephone;                /* pointer to home phone no. */
                     52:        char *name;                     /* login name */
                     53:        char *office;                   /* pointer to office name */
                     54:        char *officephone;              /* pointer to office phone no. */
                     55:        char *realname;                 /* pointer to full name */
                     56:        char *shell;                    /* user's shell */
                     57:        time_t mailread;                /* last time mail was read */
                     58:        time_t mailrecv;                /* last time mail was read */
                     59:        struct where *whead, *wtail;    /* list of where he is or has been */
                     60: } PERSON;
                     61:
                     62: enum status { LASTLOG, LOGGEDIN };
                     63:
                     64: typedef struct where {
                     65:        struct where *next;             /* next place he is or has been */
                     66:        enum status info;               /* type/status of request */
                     67:        short writable;                 /* tty is writable */
                     68:        time_t loginat;                 /* time of (last) login */
                     69:        time_t idletime;                /* how long idle (if logged in) */
                     70:        char tty[UT_LINESIZE+1];        /* null terminated tty line */
                     71:        char host[UT_HOSTSIZE+1];       /* null terminated remote host name */
                     72: } WHERE;
                     73:
                     74: #define        HBITS   8                       /* number of bits in hash code */
                     75: #define        HSIZE   (1 << 8)                /* hash table size */
                     76: #define        HMASK   (HSIZE - 1)             /* hash code mask */
                     77:
                     78: PERSON *htab[HSIZE];                   /* the buckets */
                     79: PERSON *phead, *ptail;                 /* the linked list of all people */
                     80:
                     81: PERSON *enter_person(), *find_person(), *palloc();
                     82: WHERE *walloc();