1#include "../git-compat-util.h"23char *gitstrcasestr(const char *haystack, const char *needle)4{5int nlen = strlen(needle);6int hlen = strlen(haystack) - nlen + 1;7int i;89for (i = 0; i < hlen; i++) {10int j;11for (j = 0; j < nlen; j++) {12unsigned char c1 = haystack[i+j];13unsigned char c2 = needle[j];14if (toupper(c1) != toupper(c2))15goto next;16}17return (char *) haystack + i;18next:19;20}21return NULL;22}