home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume6 / lbl / src / keyword.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-11-30  |  826 b   |  39 lines

  1. /* (C) C.D.F. Miller, Heriot-Watt University, March 1984
  2.  *
  3.  *    Permission is hereby given to reproduce or modify this
  4.  *    software freely, provided that this notice be retained,
  5.  *    and that no use be made of the software for commercial
  6.  *    purposes without the express written permission of the
  7.  *    author.
  8.  */
  9.  
  10. /* keyword.c:
  11.  *    look up a command keyword (by sequential search).
  12.  */
  13.  
  14. #include    <lbl.h>
  15.  
  16. extern int    a_delimiter();
  17. extern int    a_format();
  18. extern int    a_last();
  19.  
  20. keyword keytable[] =
  21. {
  22.     { "delimiter",    a_delimiter,    2,    2  },
  23.     { "format",    a_format,    3,    3  },
  24.     { "last",    a_last,        3,    22 }
  25. };
  26. #define NKEYS    (sizeof(keytable) / sizeof(keyword))
  27.  
  28. keyword *
  29. findkeyword(word)
  30.     char    *word;
  31. {
  32.     int    indx;
  33.  
  34.     for (indx=0; indx < NKEYS; indx++)
  35.         if (strcmp(word, keytable[indx].k_name) == 0)
  36.             return keytable+indx;
  37.     return NULL;
  38. }
  39.