ack/util/ncgg/strlookup.c
George Koehler 87a2315037 strcmp, strncmp are in <string.h>
*Important:*  Do `make clean` to work around a problem and prevent
infinite rebuilds, https://github.com/davidgiven/ack/issues/68

I edit tokens.g in util/LLgen/src, so I regenerate tokens.c.  The
regeneration script bootstrap.sh can't find LLgen, but I can run the
same command by typing the path to llgen.
2017-11-14 17:35:35 -05:00

27 lines
553 B
C

/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#ifndef NORCSID
static char rcsid[]= "$Id$";
#endif
#include <string.h>
#include "param.h"
#include "extern.h"
int nstrings=0;
char *l_strings[MAXSTRINGS];
strlookup(str) char *str; {
register i;
extern char *mystrcpy();
for(i=0;i<nstrings;i++)
if (strcmp(str,l_strings[i])==0)
return(i);
NEXT(nstrings,MAXSTRINGS,"String table");
l_strings[i] = mystrcpy(str);
return(i);
}