home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / N / TCPIP / NETKIT-B.05 / NETKIT-B / NetKit-B-0.05 / finger / finger.h,v < prev    next >
Encoding:
Text File  |  1994-05-23  |  3.9 KB  |  116 lines

  1. head    1.1;
  2. access;
  3. symbols;
  4. locks
  5.     rzsfl:1.1; strict;
  6. comment    @ * @;
  7.  
  8.  
  9. 1.1
  10. date    94.05.23.09.03.28;    author rzsfl;    state Exp;
  11. branches;
  12. next    ;
  13.  
  14.  
  15. desc
  16. @Original
  17. @
  18.  
  19.  
  20. 1.1
  21. log
  22. @Initial revision
  23. @
  24. text
  25. @/*
  26.  * Copyright (c) 1989 The Regents of the University of California.
  27.  * All rights reserved.
  28.  *
  29.  * This code is derived from software contributed to Berkeley by
  30.  * Tony Nardo of the Johns Hopkins University/Applied Physics Lab.
  31.  *
  32.  * Redistribution and use in source and binary forms, with or without
  33.  * modification, are permitted provided that the following conditions
  34.  * are met:
  35.  * 1. Redistributions of source code must retain the above copyright
  36.  *    notice, this list of conditions and the following disclaimer.
  37.  * 2. Redistributions in binary form must reproduce the above copyright
  38.  *    notice, this list of conditions and the following disclaimer in the
  39.  *    documentation and/or other materials provided with the distribution.
  40.  * 3. All advertising materials mentioning features or use of this software
  41.  *    must display the following acknowledgement:
  42.  *    This product includes software developed by the University of
  43.  *    California, Berkeley and its contributors.
  44.  * 4. Neither the name of the University nor the names of its contributors
  45.  *    may be used to endorse or promote products derived from this software
  46.  *    without specific prior written permission.
  47.  *
  48.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  49.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  50.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  51.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  52.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  53.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  54.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  55.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  56.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  57.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  58.  * SUCH DAMAGE.
  59.  *
  60.  *    from: @@(#)finger.h    5.5 (Berkeley) 6/1/90
  61.  *    $Id: finger.h,v 1.3 1993/10/07 19:58:30 brezak Exp $
  62.  */
  63.  
  64. #include <pwd.h>
  65. #include <utmp.h>
  66.  
  67. #define _PATH_MAILSPOOL "/var/mail"
  68.  
  69. /*
  70.  * All unique persons are linked in a list headed by "head" and linkd
  71.  * by the "next" field, as well as kept in a hash table.
  72.  */
  73.  
  74. typedef struct person {
  75.     struct person *next;        /* link to next person */
  76.     struct person *hlink;        /* link to next person in hash bucket */
  77.     uid_t uid;            /* user id */
  78.     char *dir;            /* user's home directory */
  79.     char *homephone;        /* pointer to home phone no. */
  80.     char *name;            /* login name */
  81.     char *office;            /* pointer to office name */
  82.     char *officephone;        /* pointer to office phone no. */
  83.     char *realname;            /* pointer to full name */
  84.     char *shell;            /* user's shell */
  85.     time_t mailread;        /* last time mail was read */
  86.     time_t mailrecv;        /* last time mail was read */
  87.     struct where *whead, *wtail;    /* list of where he is or has been */
  88. } PERSON;
  89.  
  90. enum status { LASTLOG, LOGGEDIN };
  91.  
  92. typedef struct where {
  93.     struct where *next;        /* next place he is or has been */
  94.     enum status info;        /* type/status of request */
  95.     short writable;            /* tty is writable */
  96.     time_t loginat;            /* time of (last) login */
  97.     time_t idletime;        /* how long idle (if logged in) */
  98.     char tty[UT_LINESIZE+1];    /* null terminated tty line */
  99.     char host[UT_HOSTSIZE+1];    /* null terminated remote host name */
  100. } WHERE;
  101.  
  102. #define    HBITS    8            /* number of bits in hash code */
  103. #define    HSIZE    (1 << 8)        /* hash table size */
  104. #define    HMASK    (HSIZE - 1)        /* hash code mask */
  105.  
  106. PERSON *htab[HSIZE];            /* the buckets */
  107. PERSON *phead, *ptail;            /* the linked list of all people */
  108.  
  109. int entries;                /* number of people */
  110.  
  111. PERSON *enter_person(), *find_person(), *palloc();
  112. WHERE *walloc();
  113.  
  114. extern char tbuf[1024];            /* temp buffer for anybody */
  115. @
  116.