From bd1ff5e87a5946d5898a0f569584648164086042 Mon Sep 17 00:00:00 2001 From: jtc Date: Tue, 21 Dec 1993 19:24:09 +0000 Subject: [PATCH] Fix bug #12, strtod() now uses localeconv() to get locale specific decimal point character. --- lib/libc/stdlib/strtod.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/libc/stdlib/strtod.c b/lib/libc/stdlib/strtod.c index 5bcd5ff79f67..dd4a61e660b7 100644 --- a/lib/libc/stdlib/strtod.c +++ b/lib/libc/stdlib/strtod.c @@ -86,7 +86,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$Id: strtod.c,v 1.10 1993/12/21 18:59:11 jtc Exp $"; +static char *rcsid = "$Id: strtod.c,v 1.11 1993/12/21 19:24:09 jtc Exp $"; #endif /* LIBC_SCCS and not lint */ #ifdef i386 @@ -115,6 +115,7 @@ static char *rcsid = "$Id: strtod.c,v 1.10 1993/12/21 18:59:11 jtc Exp $"; #ifndef KR_headers #include "stdlib.h" #include "string.h" +#include "locale.h" #else #include "malloc.h" #include "memory.h" @@ -1194,9 +1195,17 @@ strtod Long L; unsigned Long y, z; Bigint *bb, *bb1, *bd, *bd0, *bs, *delta; + +#ifndef KR_headers + CONST char decimal_point = localeconv()->decimal_point[0]; +#else + CONST char decimal_point = '.'; +#endif + sign = nz0 = nz = 0; rv = 0.; + for(s = s00; isspace(*s); s++) ; @@ -1226,7 +1235,7 @@ strtod else if (nd < 16) z = 10*z + c - '0'; nd0 = nd; - if (c == '.') { + if (c == decimal_point) { c = *++s; if (!nd) { for(; c == '0'; c = *++s)