summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdio/vfscanf.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c
index 04ce95c..5181a4e 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:
OpenPOWER on IntegriCloud