home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 125.img / PRO-C4.ZIP / BENCH1.ZIP / BENCH / SACRED.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-28  |  1.4 KB  |  58 lines

  1. /* ==( bench/sacred.c )== */
  2.  
  3. /* ----------------------------------------------- */
  4. /* Pro-C  Copyright (C) 1988 - 1990 Vestronix Inc. */
  5. /* Modification to this source is not supported    */
  6. /* by Vestronix Inc.                               */
  7. /*            All Rights Reserved                  */
  8. /* ----------------------------------------------- */
  9. /* Written   Nig   1-Jan-88                        */
  10. /* Modified  Geo   4-Jan-90  See comments below    */
  11. /* ----------------------------------------------- */
  12. /* %W%  (%H% %T%) */
  13.  
  14. /*
  15.  *  Modifications
  16.  *
  17.  *   4-Jan-90  Geo - V2 version hacked from filmod
  18.  *
  19. */
  20.  
  21. # include <stdio.h>
  22. # include <bench.h>
  23.  
  24. /* test validity of potential file names */
  25. int sacred(name)
  26. char *name;
  27. {
  28.     static char    *reswords[] = 
  29.     {
  30.         /* Pro-C reserved words */
  31.         "help", "error", "get", "put", "new", "zero", "fill",
  32.         "comp", "extra", "menu",
  33.  
  34.         /* MSDOS reserved words */
  35.         "prn", "lpt1", "lpt2", "lpt3", "com1", "com2", "com3", "com4",
  36.         "nul", "aux", "con",
  37.  
  38.         NULL
  39.     };
  40.     char **ptr;
  41.  
  42.     /* omitted in elemod version */
  43.     if (*name == '\0')
  44.         return(TRUE);
  45.  
  46.     if (isdigit(*name))
  47.         return(errmsg("Invalid identifier ^%s^\ncannot begin with a number", name));
  48.  
  49.     strlwr(name);
  50.  
  51.     for (ptr = reswords; *ptr != NULL; ptr++)
  52.         if (strcmp(name, *ptr) == 0)
  53.             return(errmsg("Identifier ^%s^ is reserved\nby Pro-C or the compiler", name));
  54.  
  55.     return(FALSE);
  56. }
  57.  
  58.