diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c index 04ce95c597ff..5181a4eb54bd 100644 --- a/lib/libc/stdio/vfscanf.c +++ b/lib/libc/stdio/vfscanf.c @@ -60,7 +60,11 @@ static const char rcsid[] = #define FLOATING_POINT +#ifdef FLOATING_POINT +#include #include "floatio.h" +#endif + #define BUF 513 /* Maximum length of numeric string. */ /* @@ -140,6 +144,9 @@ __svfscanf(FILE *fp, char const *fmt0, va_list ap) /* `basefix' is used to avoid `if' tests in the integer scanner */ static short basefix[17] = { 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; +#ifdef FLOATING_POINT + char decimal_point = localeconv()->decimal_point[0]; +#endif nassigned = 0; nconversions = 0; @@ -616,12 +623,6 @@ again: c = *fmt++; goto fok; } break; - case '.': - if (flags & DPTOK) { - flags &= ~(SIGNOK | DPTOK); - goto fok; - } - break; case 'e': case 'E': /* no exponent without some digits */ if ((flags&(NDIGITS|EXPOK)) == EXPOK) { @@ -631,6 +632,13 @@ again: c = *fmt++; goto fok; } break; + default: + if ((char)c == decimal_point && + (flags & DPTOK)) { + flags &= ~(SIGNOK | DPTOK); + goto fok; + } + break; } break; fok: