+int ustrnicmp(wchar_t const *lhs, wchar_t const *rhs, int maxlen) {
+ wchar_t lc = 0, rc = 0;
+ while (maxlen-- > 0 &&
+ (lc = utolower(*lhs)) == (rc = utolower(*rhs)) && lc && rc)
+ lhs++, rhs++;
+ if (lc < rc)
+ return -1;
+ else if (lc > rc)
+ return 1;
+ else
+ return 0;
+}
+