diff --git a/lang/cem/libcc.ansi/stdio/doscan.c b/lang/cem/libcc.ansi/stdio/doscan.c index 8ec2690fd..8c4fffbaa 100644 --- a/lang/cem/libcc.ansi/stdio/doscan.c +++ b/lang/cem/libcc.ansi/stdio/doscan.c @@ -174,6 +174,8 @@ _doscan(register FILE *stream, const char *format, va_list ap) long double ld_val; #endif + if (!*format) return 0; + while (1) { if (isspace(*format)) { while (isspace(*format)) diff --git a/lang/cem/libcc.ansi/stdio/ungetc.c b/lang/cem/libcc.ansi/stdio/ungetc.c index dfe5cb125..e78bf265c 100644 --- a/lang/cem/libcc.ansi/stdio/ungetc.c +++ b/lang/cem/libcc.ansi/stdio/ungetc.c @@ -19,6 +19,8 @@ ungetc(int ch, FILE *stream) } stream->_count++; p = --(stream->_ptr); /* ??? Bloody vax assembler !!! */ - *p = (unsigned char) ch; + /* ungetc() in sscanf() shouldn't write in rom */ + if (*p != (unsigned char) ch) + *p = (unsigned char) ch; return ch; }