home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / uucp / duucp-1.17 / AU-117b4-src.lha / src / lib / lsys.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-24  |  767 b   |  46 lines

  1. /*
  2.  *  LSYS.C
  3.  *
  4.  *  (C) Copyright 1989-1990 by Matthew Dillon,    All Rights Reserved.
  5.  *
  6.  */
  7.  
  8. #include <exec/types.h>
  9. #include <stdlib.h>
  10. #include <string.h>
  11. #include <stdio.h>
  12. #include "config.h"
  13.  
  14. Prototype int is_in_L_sys_file (const char *);
  15.  
  16. int
  17. is_in_L_sys_file (const char *system_name)
  18. {
  19.     static char
  20.         buf [256],
  21.         system [128];
  22.     FILE
  23.         *fd;
  24.     char
  25.         *lsysFile = MakeConfigPath (UULIB, "L.sys");
  26.  
  27.     if (!(fd = fopen (lsysFile, "r"))) {
  28.         fprintf (stderr, "Couldn't open %s\n", lsysFile);
  29.         exit (30);
  30.     }
  31.  
  32.     sprintf (system, "%s ", system_name);
  33.  
  34.     while (fgets (buf, sizeof buf, fd)) {
  35.         if (buf [0] == '#' || buf [0] == '\n')
  36.             continue;
  37.         if (strncmp (buf, system, strlen (system)) == 0) {
  38.             fclose (fd);
  39.             return TRUE;
  40.         }
  41.     }
  42.     fclose (fd);
  43.  
  44.     return FALSE;
  45. }
  46.