/* OBSOLETE FILE -- SUPERCEDED BY MWC strstr() */ /* This source file is part of the LynxLib miscellaneous library by Robert Fischer, and is Copyright 1990 by Robert Fischer. It costs no money, and you may not make money off of it, but you may redistribute it. It comes with ABSOLUTELY NO WARRANTY. See the file LYNXLIB.DOC for more details. To contact the author: Robert Fischer \\80 Killdeer Rd \\Hamden, CT 06517 USA (203) 288-9599 fischer-robert@cs.yale.edu */ #include char *sindex(str, pat) /* Searches for the string pat within the string s. */ /* Returns the pointer to the portion of the string where this occurs, */ /* or NULL if it doesn't occur */ char *str; char *pat; { register char *s,*p; if (*pat == NIL) return str; /* Empty pattern */ while(*str != NIL) { if (*pat == *str) { for(s = str+1, p = pat+1; ; p++, s++) { if (*p == NIL) return str; if (*p != *s) break; } } str++; } return NULL; }