aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorsghctoma <sghctoma@gmail.com>2018-09-03 08:57:17 +0200
committersghctoma <sghctoma@gmail.com>2018-09-03 08:57:17 +0200
commitdf730a88919b078093dbc322926ada219a60d036 (patch)
treef2837f24092c7be5dfccdf448e47062cb5718549 /common
parent67188b7cba2a985926647e049ed32c72b6ee98c8 (diff)
parentc9276f04c9fae7a211164003bc9cb8b4369db5fd (diff)
Merge remote-tracking branch 'upstream/master' into fix-freebsd-build
Diffstat (limited to 'common')
-rw-r--r--common/stringop.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/common/stringop.c b/common/stringop.c
index d9ae9925..d2c91c24 100644
--- a/common/stringop.c
+++ b/common/stringop.c
@@ -401,3 +401,17 @@ char *argsep(char **stringp, const char *delim) {
found:
return start;
}
+
+const char *strcasestr(const char *haystack, const char *needle) {
+ size_t needle_len = strlen(needle);
+ const char *pos = haystack;
+ const char *end = pos + strlen(haystack) - needle_len;
+
+ while (pos <= end) {
+ if (strncasecmp(pos, needle, needle_len) == 0) {
+ return pos;
+ }
+ ++pos;
+ }
+ return NULL;
+}