1 --- wcstoul.c.orig 2009-11-09 15:05:25.000000000 -0800
2 +++ wcstoul.c 2009-11-09 15:05:26.000000000 -0800
5 __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoul.c,v 1.2 2007/01/09 00:28:01 imp Exp $");
7 +#include "xlocale_private.h"
12 @@ -40,7 +42,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
13 * Convert a wide character string to an unsigned long integer.
16 -wcstoul(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
17 +wcstoul_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
18 + int base, locale_t loc)
22 @@ -48,13 +51,14 @@ wcstoul(const wchar_t * __restrict nptr,
26 + NORMALIZE_LOCALE(loc);
28 * See strtol for comments as to the logic used.
33 - } while (iswspace(c));
34 + } while (iswspace_l(c, loc));
38 @@ -79,8 +83,8 @@ wcstoul(const wchar_t * __restrict nptr,
39 cutlim = ULONG_MAX % base;
44 + if (iswdigit_l(c, loc))
45 + c = digittoint_l(c, loc);
48 if (c >= L'0' && c <= L'9')
49 @@ -113,3 +117,9 @@ noconv:
50 *endptr = (wchar_t *)(any ? s - 1 : nptr);
55 +wcstoul(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
57 + return wcstoul_l(nptr, endptr, base, __current_locale());