summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2002-04-17 14:58:23 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2002-04-17 14:58:23 +0000
commitd1ebf4b5cda323ef195ad488a36510faf655eee4 (patch)
treece67f728931c5293e9b24fcf83bfe181f40f512a /lib/libc
parent16adafed36017acba12c43977902a5f79ae4482a (diff)
Notes
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdio/vfscanf.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c
index e6251852d08b..bfece0bf3e69 100644
--- a/lib/libc/stdio/vfscanf.c
+++ b/lib/libc/stdio/vfscanf.c
@@ -57,7 +57,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. */
/*
@@ -123,6 +127,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;
@@ -599,12 +606,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) {
@@ -614,6 +615,13 @@ literal:
goto fok;
}
break;
+ default:
+ if ((char)c == decimal_point &&
+ (flags & DPTOK)) {
+ flags &= ~(SIGNOK | DPTOK);
+ goto fok;
+ }
+ break;
}
break;
fok:
@@ -677,10 +685,10 @@ match_failure:
*/
static u_char *
__sccl(tab, fmt)
- register char *tab;
- register u_char *fmt;
+ char *tab;
+ u_char *fmt;
{
- register int c, n, v, i;
+ int c, n, v, i;
/* first `clear' the whole table */
c = *fmt++; /* first char hat => negated scanset */