Loading...
stdlib/FreeBSD/strtoul.c.patch /dev/null Libc-391
--- /dev/null
+++ Libc/Libc-391/stdlib/FreeBSD/strtoul.c.patch
@@ -0,0 +1,47 @@
+--- strtoul.c.orig	2003-05-20 15:23:25.000000000 -0700
++++ strtoul.c	2005-02-17 12:52:46.000000000 -0800
+@@ -37,6 +37,8 @@
+ #include <sys/cdefs.h>
+ __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoul.c,v 1.16 2002/09/06 11:23:59 tjr Exp $");
+ 
++#include "xlocale_private.h"
++
+ #include <limits.h>
+ #include <ctype.h>
+ #include <errno.h>
+@@ -49,7 +51,8 @@
+  * 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;
+@@ -57,13 +60,14 @@
+ 	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++;
+@@ -117,3 +121,9 @@
+ 		*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());
++}