X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Fvfscanf.c;h=9e030fc4441f0854f95eae1cf31ae3687fd71dd6;hb=d8f2efa708a027132d443f45a8c98a0c7c1b2d77;hp=c0e607f533ed355328a33fc7861965b5d4df40a5;hpb=cbb8a6979038f96d3f67c659363cebf0615c42ba;p=musl diff --git a/src/stdio/vfscanf.c b/src/stdio/vfscanf.c index c0e607f5..9e030fc4 100644 --- a/src/stdio/vfscanf.c +++ b/src/stdio/vfscanf.c @@ -5,10 +5,7 @@ #include #include #include -#include -#include -#include -#include +#include #include "stdio_impl.h" #include "shgetc.h" @@ -92,15 +89,19 @@ int vfscanf(FILE *restrict f, const char *restrict fmt, va_list ap) continue; } if (*p != '%' || p[1] == '%') { - p += *p=='%'; shlim(f, 0); - c = shgetc(f); + if (*p == '%') { + p++; + while (isspace((c=shgetc(f)))); + } else { + c = shgetc(f); + } if (c!=*p) { shunget(f); if (c<0) goto input_fail; goto match_fail; } - pos++; + pos += shcnt(f); continue; } @@ -331,3 +332,5 @@ match_fail: FUNLOCK(f); return matches; } + +weak_alias(vfscanf,__isoc99_vfscanf);