--- gforth/engine/io.c 1999/02/28 08:37:45 1.10 +++ gforth/engine/io.c 2000/09/23 15:06:08 1.12 @@ -1,6 +1,6 @@ /* direct key io driver - Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc. + Copyright (C) 1995,1996,1997,1998,1999 Free Software Foundation, Inc. This file is part of Gforth. @@ -666,12 +666,13 @@ long key_avail (FILE * stream) /* When compiling and running in the `Posix' environment, Ultrix does not restart system calls, so this needs to do it. */ -unsigned getkey(FILE * stream) +Cell getkey(FILE * stream) { - int result; + Cell result; unsigned char c; - if(!terminal_prepped) prep_terminal(); + if(!terminal_prepped) + prep_terminal(); while (pending < 0) { @@ -692,7 +693,9 @@ unsigned getkey(FILE * stream) return (EOF); } - result = (int) pending; + /* otherwise there is a character pending; + return it and delete pending char */ + result = (Cell) pending; pending = -1L; return result;