strlookup.c 487 B

1234567891011121314151617181920212223
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. #include <string.h>
  6. #include "param.h"
  7. #include "error.h"
  8. #include "extern.h"
  9. int nstrings=0;
  10. char *l_strings[MAXSTRINGS];
  11. int strlookup(char *str)
  12. {
  13. int i;
  14. for(i=0;i<nstrings;i++)
  15. if (strcmp(str,l_strings[i])==0)
  16. return(i);
  17. NEXT(nstrings,MAXSTRINGS,"String table");
  18. l_strings[i] = mystrcpy(str);
  19. return(i);
  20. }