12345678910111213141516171819202122232425262728293031323334353637383940 |
- /* (C) C.D.F. Miller, Heriot-Watt University, March 1984
- *
- * Permission is hereby given to reproduce or modify this
- * software freely, provided that this notice be retained,
- * and that no use be made of the software for commercial
- * purposes without the express written permission of the
- * author.
- */
- /* keyword.c:
- * look up a command keyword (by sequential search).
- */
- #include <string.h>
- #include <lbl.h>
- #include "keyword.h"
- extern int a_delimiter();
- extern int a_format();
- extern int a_last();
- static Keyword keytable[] = {
- {"delimiter", a_delimiter, 2, 2},
- {"format", a_format, 3, 3},
- {"last", a_last, 3, 22}
- };
- #define NKEYS (sizeof(keytable) / sizeof(Keyword))
- Keyword *
- findkeyword(char *word)
- {
- unsigned long indx;
- for (indx = 0; indx < NKEYS; indx++)
- if (strcmp(word, keytable[indx].k_name) == 0)
- return keytable + indx;
- return NULL;
- }
|