crossroads

Git mirror of https://crossroads.e-tunity.com/
git clone git://git.finwo.net/app/crossroads
Log | Files | Refs

strcasestr.c (784B)


      1 /*************************************************************************
      2  * This file is part of Crosroads 1.23, a load balancer and fail over
      3  * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL.
      4  * Visit http://crossroads.e-tunity.com for information.
      5  *************************************************************************/
      6 #include "crossroads.h"
      7 
      8 #ifndef HAVE_STRCASESTR
      9 char *strcasestr (char const *big, char const *little) {
     10     char *bcopy, *lcopy, *res;
     11     
     12     if (!little || !*little)
     13 	return (big);
     14     if (!big || !*big)
     15 	return (0);
     16 
     17     bcopy = strupr (xstrdup (big));
     18     lcopy = strupr (xstrdup (little));
     19     if ( (res = strstr (big, little)) )
     20 	res = big + (res - bcopy);
     21     free (bcopy);
     22     free (lcopy);
     23     return (res);
     24 }
     25 #endif
     26 
     27 
     28