Use decimal point from localeconv() instead of hardcoded '.' (SUSv2)

This commit is contained in:
ache 2001-02-10 05:46:05 +00:00
parent d158cad1b5
commit 5776262f6c

View File

@ -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 @@ 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: