summaryrefslogtreecommitdiff
path: root/src/string.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/string.cpp')
-rw-r--r--src/string.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/string.cpp b/src/string.cpp
index 8b22937ae..289031cfc 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -362,4 +362,18 @@ char *strndup(const char *s, size_t len)
memcpy(tmp, s, len);
return tmp;
}
+
+const char *strcasestr(const char *haystack, const char *needle)
+{
+ size_t hay_len = strlen(haystack);
+ size_t needle_len = strlen(needle);
+ while (hay_len >= needle_len) {
+ if (strncasecmp(haystack, needle, needle_len) == 0) return haystack;
+
+ haystack++;
+ hay_len--;
+ }
+
+ return NULL;
+}
#endif /* !_GNU_SOURCE */