Make key return -1 on EOF.

This commit is contained in:
Brad Nelson
2023-01-15 19:26:56 -08:00
parent d78953151a
commit 5189669562
2 changed files with 3 additions and 2 deletions

View File

@ -104,7 +104,7 @@ decimal
( Hookup I/O )
: stdout-write ( a n -- ) stdout -rot write drop ;
: stdin-key ( -- n ) 0 >r stdin rp@ 1 read drop r> ;
: stdin-key ( -- n ) 0 >r stdin rp@ 1 read 0= if rdrop -1 exit then r> ;
also forth definitions
: default-type stdout-write ;