master
1#include <wchar.h>
2#include <wctype.h>
3
4int wcsncasecmp(const wchar_t *l, const wchar_t *r, size_t n)
5{
6 if (!n--) return 0;
7 for (; *l && *r && n && (*l == *r || towlower(*l) == towlower(*r)); l++, r++, n--);
8 return towlower(*l) - towlower(*r);
9}