diff options
author | Rich Felker <dalias@aerifal.cx> | 2012-04-17 21:17:09 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2012-04-17 21:17:09 -0400 |
commit | 99fbf4cfdbb3b67f30d595a7f1c535ca17c2f969 (patch) | |
tree | 8a6c2275ef59e1392cdf92058d93182ae37fe8d3 /src | |
parent | 00722515729bb6943dc84a8c4aa9ccd715e48e74 (diff) | |
download | musl-99fbf4cfdbb3b67f30d595a7f1c535ca17c2f969.tar.gz |
make wide scanf %[ respect width
Diffstat (limited to 'src')
-rw-r--r-- | src/stdio/vfwscanf.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/stdio/vfwscanf.c b/src/stdio/vfwscanf.c index 92b7fa40..beb8e8fb 100644 --- a/src/stdio/vfwscanf.c +++ b/src/stdio/vfwscanf.c @@ -243,7 +243,7 @@ int vfwscanf(FILE *f, const wchar_t *fmt, va_list ap) int gotmatch = 0; - for (;;) { + while (width) { if ((c=getwc(f))<0) break; if (in_set(p, c) == invert) break; @@ -255,9 +255,10 @@ int vfwscanf(FILE *f, const wchar_t *fmt, va_list ap) if (s) s+=l; } pos++; + width--; gotmatch=1; } - ungetwc(c, f); + if (width) ungetwc(c, f); if (!gotmatch) goto match_fail; |