From 2c5007e4aa838b0faf1020d90661adfe0a9b6275 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Tue, 2 Dec 2008 01:27:52 -0200 Subject: Don't put EOF in the unget buffer. --- lisp/io.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lisp/io.c b/lisp/io.c index 3a33855..9db73ee 100644 --- a/lisp/io.c +++ b/lisp/io.c @@ -107,13 +107,15 @@ LispUnget(int ch) { LispUngetInfo *unget = lisp__data.unget[lisp__data.iunget]; - if (unget->offset == sizeof(unget->buffer)) { - LispWarning("character %c lost at LispUnget()", unget->buffer[0]); - memmove(unget->buffer, unget->buffer + 1, unget->offset - 1); - unget->buffer[unget->offset - 1] = ch; + if ((ch & 0xff) == ch) { + if (unget->offset == sizeof(unget->buffer)) { + LispWarning("character %c lost at LispUnget()", unget->buffer[0]); + memmove(unget->buffer, unget->buffer + 1, unget->offset - 1); + unget->buffer[unget->offset - 1] = ch; + } + else + unget->buffer[unget->offset++] = ch; } - else - unget->buffer[unget->offset++] = ch; return (ch); } -- cgit v1.2.3