~drizzle-trunk/drizzle/development

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 <my_global.h>
31
#include "m_string.h"
32
33
#ifndef HAVE_STRSTR
34
35
char *strstr(register const char *str,const char *search)
36
{
37
 register char *i,*j;
38
 register char first= *search;
39
40
skip:
41
  while (*str != '\0') {
42
    if (*str++ == first) {
43
      i=(char*) str; j=(char*) search+1;
44
      while (*j)
45
	if (*i++ != *j++) goto skip;
46
      return ((char*) str-1);
47
    }
48
  }
49
  return ((char*) 0);
50
} /* strstr */
51
52
#endif