diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 2001-02-10 05:46:05 +0000 |
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 2001-02-10 05:46:05 +0000 |
| commit | a2a135c94ffb19a23d5886455c71fc7e19f7c0cf (patch) | |
| tree | 04f91bd3d053cfba6c2624818f251b6fd4b3a2b6 /lib/libc/stdio | |
| parent | 05a6e1e59bac86186a25e710c1d92af06cdc5267 (diff) | |
Notes
Diffstat (limited to 'lib/libc/stdio')
| -rw-r--r-- | lib/libc/stdio/vfscanf.c | 20 |
1 files changed, 14 insertions, 6 deletions
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 <locale.h> #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 @@ literal: 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 @@ literal: goto fok; } break; + default: + if ((char)c == decimal_point && + (flags & DPTOK)) { + flags &= ~(SIGNOK | DPTOK); + goto fok; + } + break; } break; fok: |
