From e098c2b8d02db042d701480760ee664eae5c0ce1 Mon Sep 17 00:00:00 2001 From: Jan Breuer <jan.breuer@jaybee.cz> Date: 周二, 22 10月 2013 18:04:54 +0800 Subject: [PATCH] Merge strncasecmp detection from 'master' --- libscpi/src/utils.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/libscpi/src/utils.c b/libscpi/src/utils.c index f8e09fa..78b7efe 100644 --- a/libscpi/src/utils.c +++ b/libscpi/src/utils.c @@ -391,3 +391,21 @@ } #endif +#if !HAVE_STRNCASECMP && !HAVE_STRNICMP +int OUR_strncasecmp(const char *s1, const char *s2, size_t n) { + unsigned char c1, c2; + + for(; n != 0; n--) { + c1 = tolower((unsigned char)*s1++); + c2 = tolower((unsigned char)*s2++); + if (c1 != c2) { + return c1 - c2; + } + if (c1 = '\0') { + return 0; + } + } + return 0; +} +#endif + -- Gitblit v1.9.1