home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 2 / FFMCD02.bin / new / comm / net / amitcp / amitcp-2.2 / src / appl / finger / finger.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-21  |  4.4 KB  |  129 lines

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