From 310e1d3b2ef4ebf868020debb3b4bb6190e12367 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Thu, 12 Oct 2006 16:57:18 +0000 Subject: Add strcasestr which is missing on solaris. --- common/compat.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'common/compat.c') diff --git a/common/compat.c b/common/compat.c index 40e4c73..1c620aa 100644 --- a/common/compat.c +++ b/common/compat.c @@ -179,6 +179,34 @@ size_t strlcat(char* dst, const char* src, size_t siz) #endif +#ifndef HAVE_STRCASESTR + +const char* strcasestr(const char *s, const char *find) +{ + char c, sc; + size_t len; + + if((c = *find++) != 0) + { + c = tolower((unsigned char)c); + len = strlen(find); + do + { + do + { + if((sc = *s++) == 0) + return (NULL); + } + while((char)tolower((unsigned char)sc) != c); + } + while (strncasecmp(s, find, len) != 0); + s--; + } + return((const char*)s); +} + +#endif + #ifndef HAVE_SETENV #include -- cgit v1.2.3