diff options
author | ache <ache@FreeBSD.org> | 2001-02-10 05:05:09 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2001-02-10 05:05:09 +0000 |
commit | 4060fa06fa215aa7faafcf3f3136658fcd8d5255 (patch) | |
tree | 1c7bbbd4cb50dd29597cbf8df098717a4b4005a8 /lib/libc/stdlib/strtod.c | |
parent | 5e1021a55a41e1694da94c98f925c9bc15bb6dfb (diff) | |
download | FreeBSD-src-4060fa06fa215aa7faafcf3f3136658fcd8d5255.zip FreeBSD-src-4060fa06fa215aa7faafcf3f3136658fcd8d5255.tar.gz |
Use decimap_point from localeconv() instead of hardcoded '.'
Obtained from: inspired by NetBSD strtod
Diffstat (limited to 'lib/libc/stdlib/strtod.c')
-rw-r--r-- | lib/libc/stdlib/strtod.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/stdlib/strtod.c b/lib/libc/stdlib/strtod.c index c4fe241..742398e 100644 --- a/lib/libc/stdlib/strtod.c +++ b/lib/libc/stdlib/strtod.c @@ -134,6 +134,7 @@ static char sccsid[] = "@(#)strtod.c 8.1 (Berkeley) 6/4/93"; #define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);} #endif +#include <locale.h> #ifdef __cplusplus #include "malloc.h" #include "memory.h" @@ -1202,6 +1203,8 @@ strtod long L; unsigned long y, z; Bigint *bb, *bb1, *bd, *bd0, *bs, *delta; + char decimal_point = localeconv()->decimal_point[0]; + sign = nz0 = nz = 0; rv = 0.; for (s = s00;;s++) switch(*s) { @@ -1235,7 +1238,7 @@ strtod else if (nd < 16) z = 10*z + c - '0'; nd0 = nd; - if (c == '.') { + if ((char)c == decimal_point) { c = *++s; if (!nd) { for (; c == '0'; c = *++s) |