diff --git a/lang/cem/libcc.ansi/stdio/doscan.c b/lang/cem/libcc.ansi/stdio/doscan.c index 7a95d4cd6..c0957cb25 100644 --- a/lang/cem/libcc.ansi/stdio/doscan.c +++ b/lang/cem/libcc.ansi/stdio/doscan.c @@ -204,7 +204,11 @@ _doscan(register FILE *stream, const char *format, va_list ap) if (*format != '%') { ic = getc(stream); nrchars++; - if (ic != *format++) break; /* error */ + if (ic != *format++) { + if (ic != EOF) ungetc(ic,stream); + nrchars--; + break; /* error */ + } continue; } format++;