diff options
Diffstat (limited to 'csync/src/std')
-rw-r--r-- | csync/src/std/c_string.c | 8 | ||||
-rw-r--r-- | csync/src/std/c_string.h | 11 |
2 files changed, 19 insertions, 0 deletions
diff --git a/csync/src/std/c_string.c b/csync/src/std/c_string.c index 9d2c087ec..f1ca5f747 100644 --- a/csync/src/std/c_string.c +++ b/csync/src/std/c_string.c @@ -134,6 +134,14 @@ static char *c_iconv(const char* str, enum iconv_direction dir) } #endif /* defined(HAVE_ICONV) && defined(WITH_ICONV) */ +int c_strncasecmp(const char *a, const char *b, size_t n) { +#ifdef _WIN32 + return _strnicmp(a, b, n); +#else + return strncasecmp(a, b, n); +#endif +} + int c_streq(const char *a, const char *b) { register const char *s1 = a; register const char *s2 = b; diff --git a/csync/src/std/c_string.h b/csync/src/std/c_string.h index d80727a63..920266c5c 100644 --- a/csync/src/std/c_string.h +++ b/csync/src/std/c_string.h @@ -60,6 +60,17 @@ struct c_strlist_s { }; /** + * @brief Compare to strings case insensitively. + * + * @param a First string to compare. + * @param b Second string to compare. + * @param n Max comparison length. + * + * @return see strncasecmp + */ +int c_strncasecmp(const char *a, const char *b, size_t n); + +/** * @brief Compare to strings if they are equal. * * @param a First string to compare. |