strlookup.c 513 B

123456789101112131415161718192021222324
  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. #ifndef NORCSID
  6. static char rcsid[]= "$Id$";
  7. #endif
  8. #include "param.h"
  9. int nstrings=0;
  10. char *l_strings[MAXSTRINGS];
  11. strlookup(str) char *str; {
  12. register i;
  13. extern char *mystrcpy();
  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. }