summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-12-02 01:27:52 -0200
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-12-02 01:27:52 -0200
commit2c5007e4aa838b0faf1020d90661adfe0a9b6275 (patch)
tree022264dfb450f8e68c1f23a772dfc03cb93aae09 /lisp
parente79879904eea8495b28d7895ce126269a9ef300f (diff)
Don't put EOF in the unget buffer.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/io.c14
1 files 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);
}