Loading...
--- /dev/null
+++ Libc/Libc-583/stdlib/FreeBSD/strtol.c.patch
@@ -0,0 +1,48 @@
+--- strtol.c.orig 2003-05-20 15:23:25.000000000 -0700
++++ strtol.c 2005-02-17 00:43:42.000000000 -0800
+@@ -37,6 +37,8 @@
+ #include <sys/cdefs.h>
+ __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtol.c,v 1.17 2002/09/06 11:23:59 tjr Exp $");
+
++#include "xlocale_private.h"
++
+ #include <limits.h>
+ #include <ctype.h>
+ #include <errno.h>
+@@ -50,7 +52,8 @@
+ * alphabets and digits are each contiguous.
+ */
+ long
+-strtol(const char * __restrict nptr, char ** __restrict endptr, int base)
++strtol_l(const char * __restrict nptr, char ** __restrict endptr, int base,
++ locale_t loc)
+ {
+ const char *s;
+ unsigned long acc;
+@@ -58,6 +61,7 @@
+ unsigned long cutoff;
+ int neg, any, cutlim;
+
++ NORMALIZE_LOCALE(loc);
+ /*
+ * Skip white space and pick up leading +/- sign if any.
+ * If base is 0, allow 0x for hex and 0 for octal, else
+@@ -66,7 +70,7 @@
+ s = nptr;
+ do {
+ c = *s++;
+- } while (isspace((unsigned char)c));
++ } while (isspace_l((unsigned char)c, loc));
+ if (c == '-') {
+ neg = 1;
+ c = *s++;
+@@ -139,3 +143,9 @@
+ *endptr = (char *)(any ? s - 1 : nptr);
+ return (acc);
+ }
++
++long
++strtol(const char * __restrict nptr, char ** __restrict endptr, int base)
++{
++ return strtol_l(nptr, endptr, base, __current_locale());
++}