bug fixes for scanf()

This commit is contained in:
eck 1990-03-28 16:33:05 +00:00
parent 3553a28b78
commit 0bb4c0167c
2 changed files with 5 additions and 1 deletions

View file

@ -174,6 +174,8 @@ _doscan(register FILE *stream, const char *format, va_list ap)
long double ld_val; long double ld_val;
#endif #endif
if (!*format) return 0;
while (1) { while (1) {
if (isspace(*format)) { if (isspace(*format)) {
while (isspace(*format)) while (isspace(*format))

View file

@ -19,6 +19,8 @@ ungetc(int ch, FILE *stream)
} }
stream->_count++; stream->_count++;
p = --(stream->_ptr); /* ??? Bloody vax assembler !!! */ 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; return ch;
} }