--- strtoul.c.bsdnew 2009-11-13 14:11:52.000000000 -0800 +++ strtoul.c 2009-11-13 14:11:52.000000000 -0800 @@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtoul.c 8. #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoul.c,v 1.19 2007/01/09 00:28:10 imp Exp $"); +#include "xlocale_private.h" + #include <limits.h> #include <ctype.h> #include <errno.h> @@ -45,7 +47,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/ * alphabets and digits are each contiguous. */ unsigned long -strtoul(const char * __restrict nptr, char ** __restrict endptr, int base) +strtoul_l(const char * __restrict nptr, char ** __restrict endptr, int base, + locale_t loc) { const char *s; unsigned long acc; @@ -53,13 +56,14 @@ strtoul(const char * __restrict nptr, ch unsigned long cutoff; int neg, any, cutlim; + NORMALIZE_LOCALE(loc); /* * See strtol for comments as to the logic used. */ s = nptr; do { c = *s++; - } while (isspace((unsigned char)c)); + } while (isspace_l((unsigned char)c, loc)); if (c == '-') { neg = 1; c = *s++; @@ -116,3 +120,9 @@ noconv: *endptr = (char *)(any ? s - 1 : nptr); return (acc); } + +unsigned long +strtoul(const char * __restrict nptr, char ** __restrict endptr, int base) +{ + return strtoul_l(nptr, endptr, base, __current_locale()); +}