X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Fvfscanf.c;h=9e030fc4441f0854f95eae1cf31ae3687fd71dd6;hb=6aeb9c6703670649ee09b3c8575fb428168bb75c;hp=68c8e2cf2fd9fcb2f98624d1961c8390ddab8c0e;hpb=1d92cddb1e1ed4b6cc0e55461727561e7a2522e0;p=musl diff --git a/src/stdio/vfscanf.c b/src/stdio/vfscanf.c index 68c8e2cf..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; } @@ -118,6 +119,8 @@ int vfscanf(FILE *restrict f, const char *restrict fmt, va_list ap) } if (*p=='m') { + wcs = 0; + s = 0; alloc = !!dest; p++; } else { @@ -329,3 +332,5 @@ match_fail: FUNLOCK(f); return matches; } + +weak_alias(vfscanf,__isoc99_vfscanf);