Browse Source

replace stub with working strcasestr

Rich Felker 12 years ago
parent
commit
e864ddc368
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/string/strcasestr.c

+ 4 - 2
src/string/strcasestr.c

@@ -1,7 +1,9 @@
+#define _GNU_SOURCE
 #include <string.h>
 
 char *strcasestr(const char *h, const char *n)
 {
-	//FIXME!
-	return strstr(h, n);
+	size_t l = strlen(n);
+	for (; *h; h++) if (!strncasecmp(h, n, l)) return (char *)h;
+	return 0;
 }