about summary refs log tree commit diff
path: root/src/stdio/vfscanf.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio/vfscanf.c')
-rw-r--r--src/stdio/vfscanf.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/stdio/vfscanf.c b/src/stdio/vfscanf.c
index d4d2454b..9e030fc4 100644
--- a/src/stdio/vfscanf.c
+++ b/src/stdio/vfscanf.c
@@ -89,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;
 		}