compat / strcasestr.con commit Bugfix: stop if directory already exists (b0c698a)
   1#include <string.h>
   2#include <ctype.h>
   3
   4char *gitstrcasestr(const char *haystack, const char *needle)
   5{
   6        int nlen = strlen(needle);
   7        int hlen = strlen(haystack) - nlen + 1;
   8        int i;
   9
  10        for (i = 0; i < hlen; i++) {
  11                int j;
  12                for (j = 0; j < nlen; j++) {
  13                        unsigned char c1 = haystack[i+j];
  14                        unsigned char c2 = needle[j];
  15                        if (toupper(c1) != toupper(c2))
  16                                goto next;
  17                }
  18                return (char *) haystack + i;
  19        next:
  20                ;
  21        }
  22        return NULL;
  23}