1570af302Sopenharmony_ci#include <wchar.h>
2570af302Sopenharmony_ci#include <wctype.h>
3570af302Sopenharmony_ci
4570af302Sopenharmony_ciint wcsncasecmp(const wchar_t *l, const wchar_t *r, size_t n)
5570af302Sopenharmony_ci{
6570af302Sopenharmony_ci	if (!n--) return 0;
7570af302Sopenharmony_ci	for (; *l && *r && n && (*l == *r || towlower(*l) == towlower(*r)); l++, r++, n--);
8570af302Sopenharmony_ci	return towlower(*l) - towlower(*r);
9570af302Sopenharmony_ci}
10