From: eck Date: Wed, 28 Mar 1990 16:33:05 +0000 (+0000) Subject: bug fixes for scanf() X-Git-Tag: release-5-5~1768 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=0bb4c0167cfe11be5d0d031668104e0c09c633b1;p=ack.git bug fixes for scanf() --- 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; }