1
by brian
clean slate |
1 |
/* Copyright (C) 2002 MySQL AB
|
2 |
|
|
3 |
This library is free software; you can redistribute it and/or
|
|
4 |
modify it under the terms of the GNU Library General Public
|
|
5 |
License as published by the Free Software Foundation; version 2
|
|
6 |
of the License.
|
|
7 |
|
|
8 |
This library is distributed in the hope that it will be useful,
|
|
9 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
11 |
Library General Public License for more details.
|
|
12 |
|
|
13 |
You should have received a copy of the GNU Library General Public
|
|
14 |
License along with this library; if not, write to the Free
|
|
15 |
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
|
16 |
MA 02111-1307, USA */
|
|
17 |
||
18 |
/* File : strstr.c
|
|
19 |
Author : Monty
|
|
20 |
Updated: 1986.11.24
|
|
21 |
Defines: strstr()
|
|
22 |
||
23 |
strstr(src, pat) looks for an instance of pat in src. pat is not a
|
|
24 |
regex(3) pattern, it is a literal string which must be matched exactly.
|
|
25 |
The result is a pointer to the first character of the located instance,
|
|
26 |
or NullS if pat does not occur in src.
|
|
27 |
||
28 |
*/
|
|
29 |
||
30 |
#include "m_string.h" |
|
31 |
||
32 |
#ifndef HAVE_STRSTR
|
|
33 |
||
34 |
char *strstr(register const char *str,const char *search) |
|
35 |
{
|
|
36 |
register char *i,*j; |
|
37 |
register char first= *search; |
|
38 |
||
39 |
skip: |
|
40 |
while (*str != '\0') { |
|
41 |
if (*str++ == first) { |
|
42 |
i=(char*) str; j=(char*) search+1; |
|
43 |
while (*j) |
|
44 |
if (*i++ != *j++) goto skip; |
|
45 |
return ((char*) str-1); |
|
46 |
}
|
|
47 |
}
|
|
48 |
return ((char*) 0); |
|
49 |
} /* strstr */ |
|
50 |
||
51 |
#endif
|