diff options
author | sghctoma <sghctoma@gmail.com> | 2018-09-03 08:57:17 +0200 |
---|---|---|
committer | sghctoma <sghctoma@gmail.com> | 2018-09-03 08:57:17 +0200 |
commit | df730a88919b078093dbc322926ada219a60d036 (patch) | |
tree | f2837f24092c7be5dfccdf448e47062cb5718549 /common | |
parent | Enable privilege dropping of FreeBSD (diff) | |
parent | Merge pull request #2553 from emersion/disabled-no-modeset (diff) | |
download | sway-df730a88919b078093dbc322926ada219a60d036.tar.gz sway-df730a88919b078093dbc322926ada219a60d036.tar.zst sway-df730a88919b078093dbc322926ada219a60d036.zip |
Merge remote-tracking branch 'upstream/master' into fix-freebsd-build
Diffstat (limited to 'common')
-rw-r--r-- | common/stringop.c | 14 |
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) { | |||
401 | found: | 401 | found: |
402 | return start; | 402 | return start; |
403 | } | 403 | } |
404 | |||
405 | const char *strcasestr(const char *haystack, const char *needle) { | ||
406 | size_t needle_len = strlen(needle); | ||
407 | const char *pos = haystack; | ||
408 | const char *end = pos + strlen(haystack) - needle_len; | ||
409 | |||
410 | while (pos <= end) { | ||
411 | if (strncasecmp(pos, needle, needle_len) == 0) { | ||
412 | return pos; | ||
413 | } | ||
414 | ++pos; | ||
415 | } | ||
416 | return NULL; | ||
417 | } | ||