1 //
2 // Part of the ht://Dig package   <http://www.htdig.org/>
3 // Copyright (c) 1999, 2000, 2001 The ht://Dig Group
4 // For copyright details, see the file COPYING in your distribution
5 // or the GNU General Public License version 2 or later
6 // <http://www.gnu.org/copyleft/gpl.html>
7 //
8 // $Id: strcasestr2.c,v 1.3 2014/04/17 20:27:24 sebdiaz Exp $
9 //
10 
11 #ifdef HAVE_CONFIG_H
12 #include "config.h"
13 #endif /* HAVE_CONFIG_H */
14 
15 #ifndef HAVE_STRCASESTR
16 #include <ctype.h>
17 #include <string.h>
18 
19 #include <clib.h>
20 
21 //*****************************************************************************
22 //
23 const char *
strcasestr2(const char * s,const char * pattern)24 strcasestr2(const char *s, const char *pattern)
25 {
26     int		length = strlen(pattern);
27 
28     while (*s)
29     {
30 	if (strncasecmp(s, pattern, length) == 0)
31 	    return s;
32 	s++;
33     }
34     return 0;
35 }
36 #endif /* HAVE_STRCASESTR */
37