include: reduce default stack size
[minix.git] / lib / libc / string / wcsncasecmp.c
blob66a4c7889ae7d8cce2cdfa3f0936f1b79ece50e5
1 /* $NetBSD: wcsncasecmp.c,v 1.2 2006/08/26 22:45:52 christos Exp $ */
3 /*
4 * Copyright (C) 2006 Aleksey Cheusov
6 * This material is provided "as is", with absolutely no warranty expressed
7 * or implied. Any use is at your own risk.
9 * Permission to use or copy this software for any purpose is hereby granted
10 * without fee. Permission to modify the code and to distribute modified
11 * code is also granted without any restrictions.
14 #include <sys/cdefs.h>
15 #if defined(LIBC_SCCS) && !defined(lint)
16 __RCSID("$NetBSD: wcsncasecmp.c,v 1.2 2006/08/26 22:45:52 christos Exp $");
17 #endif /* LIBC_SCCS and not lint */
19 #include "namespace.h"
20 #include <assert.h>
21 #include <wchar.h>
22 #include <wctype.h>
24 __weak_alias(wcsncasecmp,_wcsncasecmp)
26 int
27 wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n)
29 int lc1 = 0;
30 int lc2 = 0;
31 int diff = 0;
33 _DIAGASSERT(s1);
34 _DIAGASSERT(s2);
36 while (n--) {
37 lc1 = towlower (*s1);
38 lc2 = towlower (*s2);
40 diff = lc1 - lc2;
41 if (diff)
42 return diff;
44 if (!lc1)
45 return 0;
47 ++s1;
48 ++s2;
51 return 0;