aboutsummaryrefslogtreecommitdiffstats
path: root/strcasestr.c
diff options
context:
space:
mode:
Diffstat (limited to 'strcasestr.c')
-rw-r--r--strcasestr.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/strcasestr.c b/strcasestr.c
new file mode 100644
index 0000000..62bcfdb
--- /dev/null
+++ b/strcasestr.c
@@ -0,0 +1,17 @@
+/* See LICENSE file for copyright and license details. */
+#include "libsimple.h"
+
+
+char *
+libsimple_strcasestr(const char *h_, const char *n)
+{
+ char *h = *(char **)(void *)&h_;
+ size_t hn = strlen(h);
+ size_t nn = strlen(n);
+ if (hn < nn)
+ return NULL;
+ for (hn -= nn; hn--; h++)
+ if (!strcasecmp(h, n))
+ return h;
+ return NULL;
+}