1 /* strstr -
2    Copyright (C) 1995  Katsuyuki Okabe <hgc02147@niftyserve.or.jp>
3 
4    This library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Library General Public License
6    as published by the Free Software Foundation; either version 2 of
7    the License, or (at your option) any later version.
8 
9    This library is distributed in the hope that it will be useful, but
10    WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Library General Public License for more details.
13 
14    You should have received a copy of the GNU Library General Public
15    License along with this library; if not, write to the Free Software
16    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
17 
18 #ifdef HAVE_CONFIG_H
19 #include <config.h>
20 #endif
21 
22 #if HAVE_STRING_H || STDC_HEADERS
23 #include <string.h>
24 #else
25 #include <strings.h>
26 #define strchr index
27 #endif
28 
29 char *
strstr(string1,string2)30 strstr(string1, string2)
31      const char *string1;
32      const char *string2;
33 {
34   char *p;
35   int len;
36   int c;
37 
38   p = (char *)string1;
39   len = strlen(string2);
40   c = *string2;
41   while ((p = strchr(p, c)) != (char *)0)
42     {
43       if (strncmp(p, string2, len) == 0)
44 	return p;
45       p++;
46     }
47 
48   return (char *)0;
49 }
50 
51 /*
52  * End:
53  */
54