projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0072251
)
make wide scanf %[ respect width
author
Rich Felker
<dalias@aerifal.cx>
Wed, 18 Apr 2012 01:17:09 +0000
(21:17 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Wed, 18 Apr 2012 01:17:09 +0000
(21:17 -0400)
src/stdio/vfwscanf.c
patch
|
blob
|
history
diff --git
a/src/stdio/vfwscanf.c
b/src/stdio/vfwscanf.c
index 92b7fa40ac6873890e5ea1f5148fcdd3d0427fd6..beb8e8fb9049f81a2755602c2bdee20c3056fc0a 100644
(file)
--- 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;