home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume12 / mdg / part05 / loadconfig.c < prev    next >
C/C++ Source or Header  |  1991-03-04  |  979b  |  58 lines

  1. /*
  2.     MDG Multiuser Dungeon Game -- loadconfig.c reads keys
  3.     
  4.     MDG is Copyright 1990 John C. Gonnerman
  5.     This program is subject to the general MDG 
  6.     copyright statement (see enclosed file, Copyright).
  7. */
  8.  
  9. static char *sccsvers = "@(#) loadconfig.c\t(1.2)\tcreated 1/2/91";
  10.  
  11. #include <stdio.h>
  12. #include <sys/types.h>
  13. #include <sys/ipc.h>
  14. #include <sys/shm.h>
  15. #include <sys/msg.h>
  16.  
  17. #include "config.h"
  18. #include "files.h"
  19.  
  20. extern char *progname;
  21.  
  22. extern int errno;
  23. extern char *sys_errlist[];
  24.  
  25. long dmsgkey, gsemkey, mapkey, playerkey;
  26.  
  27.  
  28. loadconfig()
  29. {
  30.     FILE *fp;
  31.     char inbuf[40];
  32.  
  33.     dmsgkey = DMSGKEY;
  34.     gsemkey = GSEMKEY;
  35.     mapkey = MAPKEY;
  36.     playerkey = PLAYERKEY;
  37.  
  38.     if((fp = fopen(CONFIGFILE, "r")) == NULL)
  39.         return;
  40.  
  41.     fgets(inbuf, 40, fp);
  42.     sscanf(inbuf, "%ld", &dmsgkey);
  43.  
  44.     fgets(inbuf, 40, fp);
  45.     sscanf(inbuf, "%ld", &gsemkey);
  46.  
  47.     fgets(inbuf, 40, fp);
  48.     sscanf(inbuf, "%ld", &playerkey);
  49.  
  50.     fgets(inbuf, 40, fp);
  51.     sscanf(inbuf, "%ld", &mapkey);
  52.  
  53.     fclose(fp);
  54. }
  55.  
  56.  
  57. /* end of file. */
  58.