From 78aec6d5c67cab79e03cdbe4f1a1bd7a7aa15612 Mon Sep 17 00:00:00 2001 From: Ori Bernstein Date: Fri, 15 May 2020 16:46:20 -0700 Subject: Fix scans of more than one character in %[] This got broken in d8e877a89dae, where we returned 0 on the first mismatch; we want to return 0 only when we consumed no characters. --- sys/src/ape/lib/ap/stdio/vfscanf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys/src/ape/lib/ap/stdio') diff --git a/sys/src/ape/lib/ap/stdio/vfscanf.c b/sys/src/ape/lib/ap/stdio/vfscanf.c index 5cbc1fee5..ac09b86ea 100644 --- a/sys/src/ape/lib/ap/stdio/vfscanf.c +++ b/sys/src/ape/lib/ap/stdio/vfscanf.c @@ -416,7 +416,7 @@ icvt_sq(FILE *f, va_list *args, int store, int width, int) } if(!match(c, pat)){ nungetc(c, f); - return 0; + goto Done; } if(store) *s++=c; @@ -424,5 +424,5 @@ icvt_sq(FILE *f, va_list *args, int store, int width, int) } Done: if(store) *s='\0'; - return 1; + return nn > 0; } -- cgit v1.2.3