diff options
author | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-12-02 01:27:52 -0200 |
---|---|---|
committer | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-12-02 01:27:52 -0200 |
commit | 2c5007e4aa838b0faf1020d90661adfe0a9b6275 (patch) | |
tree | 022264dfb450f8e68c1f23a772dfc03cb93aae09 | |
parent | e79879904eea8495b28d7895ce126269a9ef300f (diff) |
Don't put EOF in the unget buffer.
-rw-r--r-- | lisp/io.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -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); } |