summaryrefslogtreecommitdiff
path: root/src/basic/string-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/string-util.c')
-rw-r--r--src/basic/string-util.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/basic/string-util.c b/src/basic/string-util.c
index 849e457439..b7b8c97bc0 100644
--- a/src/basic/string-util.c
+++ b/src/basic/string-util.c
@@ -348,6 +348,21 @@ char *ascii_strlower_n(char *t, size_t n) {
return t;
}
+int ascii_strcasecmp_n(const char *a, const char *b, size_t n) {
+
+ for (; n > 0; a++, b++, n--) {
+ int x, y;
+
+ x = (int) (uint8_t) ascii_tolower(*a);
+ y = (int) (uint8_t) ascii_tolower(*b);
+
+ if (x != y)
+ return x - y;
+ }
+
+ return 0;
+}
+
bool chars_intersect(const char *a, const char *b) {
const char *p;