fix scanf bug reading literals after width-limited field
the field width limit was not being cleared before reading the literal, causing spurious failures in scanf in cases like "%2d:" scanning "00:".
This commit is contained in:
parent
498a100d05
commit
31eaad4796
1 changed files with 1 additions and 0 deletions
|
|
@ -103,6 +103,7 @@ int vfscanf(FILE *f, const char *fmt, va_list ap)
|
||||||
}
|
}
|
||||||
if (*p != '%' || p[1] == '%') {
|
if (*p != '%' || p[1] == '%') {
|
||||||
p += *p=='%';
|
p += *p=='%';
|
||||||
|
shlim(f, 0);
|
||||||
c = shgetc(f);
|
c = shgetc(f);
|
||||||
if (c!=*p) {
|
if (c!=*p) {
|
||||||
shunget(f);
|
shunget(f);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue