From 73b54a23264ce8ef076245373258c6533e2b6510 Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 1 Apr 1996 09:08:59 +0000 Subject: [PATCH] fixed bug with %[] in doscan.c --- lang/cem/libcc.ansi/stdio/doscan.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lang/cem/libcc.ansi/stdio/doscan.c b/lang/cem/libcc.ansi/stdio/doscan.c index 770f1eae4..914feb632 100644 --- a/lang/cem/libcc.ansi/stdio/doscan.c +++ b/lang/cem/libcc.ansi/stdio/doscan.c @@ -381,9 +381,10 @@ _doscan(register FILE *stream, const char *format, va_list ap) else Xtable['-'] = 1; } } - if (!*format) return done; - - if (!(Xtable[ic] ^ reverse)) return done; + if (!*format || !(Xtable[ic] ^ reverse)) { + if (ic != EOF) ungetc(ic, stream); + return done; + } if (!(flags & FL_NOASSIGN)) str = va_arg(ap, char *);