home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1696 / immune.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-28  |  974 b   |  38 lines

  1. static char rcsid[] = "@(#)$Id: immune.c,v 2.1  07/23/90  jbc $";
  2. /***************************************************************************/
  3. /* Copyright (c) 1990  James B. Cummings, Jr.                              */
  4. /*                                                                         */
  5. /*  This program is offered in the Public Domain and is freely available   */
  6. /*    as long as this notice is kept intact with each module.              */
  7. /***************************************************************************/
  8. #include "header.h"
  9.  
  10. int
  11. immune(user)
  12. char **user;
  13. {
  14.     FILE *imfp;
  15.     char *name, s[22];
  16.     char *lastc, *strchr();
  17.     int ret;
  18.  
  19.     if((imfp = fopen(IMMUNE_FILE,"r")) < 0) {
  20.         perror("immune.file");
  21.         ret = 1;
  22.     }
  23.     else {
  24.         while ((name = fgets(s,20,imfp)) != (char *)0) {
  25.             if(lastc = strchr(name,'\n'));
  26.                 *lastc = '\0';
  27.             if(strcmp(user,name) == 0) {
  28.                 ret = 1;
  29.                 break;
  30.             }
  31.             else ret = 0;
  32.         }
  33.     }
  34.     (void) fclose(imfp);
  35.     return(ret);
  36.  
  37. }
  38.