diff options
author | pgen <p.gen.progs@gmail.com> | 2020-03-15 00:03:07 +0100 |
---|---|---|
committer | pgen <p.gen.progs@gmail.com> | 2020-03-24 19:57:27 +0100 |
commit | 7c5895a3214edee5be98e643510916f83353a3ac (patch) | |
tree | ae396457b33b2204032225dd9d3e5962d607d4aa /utils.c | |
parent | 5d51aea989338ae7be9a900e2514877bb0493efa (diff) |
xwcscasecmp is missing in C99, use a local version
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -13,6 +13,7 @@ #include <string.h> #include <ctype.h> #include <stdarg.h> +#include <wctype.h> #include "xmalloc.h" #include "list.h" #include "utils.h" @@ -279,3 +280,25 @@ isprint8(int i) return (c >= 0x20 && c < 0x7f) || (c >= (unsigned char)0xa0); } + +/* ================================================= */ +/* Private imementation of wcscasecmp wimming in c99 */ +/* ================================================= */ +int +xwcscasecmp(const wchar_t * s1, const wchar_t * s2) +{ + wchar_t c1, c2; + + while (*s1) + { + c1 = towlower(*s1); + c2 = towlower(*s2); + + if (c1 != c2) + return (int)(c1 - c2); + + s1++; + s2++; + } + return (-*s2); +} |