scanf: when an ordinary character cannot match due to EOF, flag an input failure.

This may cause scanf to return EOF, if no conversions have been done.

This seems to be the intent of the C standards, although the wording could be clearer. It is also consistent with all the other implementations I tested.
This commit is contained in:
Stephen Heumann 2021-02-08 00:15:13 -06:00
parent 23a27bd434
commit de9f830c0c
1 changed files with 4 additions and 1 deletions

View File

@ -5500,7 +5500,10 @@ ps5 stx ch make sure the char matches the format
jsl ~getchar
cmp ch
beq ps1
jsl ~putback put the character back
cmp #EOF check for EOF
bne ps6
sta ~eofFound
ps6 jsl ~putback put the character back
;
; Remove the parameters for remaining conversion specifications
;