musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013年02月21日 23:54:25 -0500
committerRich Felker <dalias@aerifal.cx>2013年02月21日 23:54:25 -0500
commite864ddc36819814b3b9ed17620459d66add512d3 (patch)
treec4277c89ee0e7fe05a923fc2053491a5bba84101
parent330fd96213da324f9164081df9a5226790d7c4ec (diff)
downloadmusl-e864ddc36819814b3b9ed17620459d66add512d3.tar.gz
replace stub with working strcasestr
Diffstat
-rw-r--r--src/string/strcasestr.c 6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/string/strcasestr.c b/src/string/strcasestr.c
index f1cb0e84..af109f36 100644
--- a/src/string/strcasestr.c
+++ b/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;
}
generated by cgit v1.2.1 (git 2.18.0) at 2025年11月02日 10:20:49 +0000

AltStyle によって変換されたページ (->オリジナル) /