summaryrefslogtreecommitdiff
path: root/streams.c
diff options
context:
space:
mode:
Diffstat (limited to 'streams.c')
-rw-r--r--streams.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/streams.c b/streams.c
index beed5b1..5706566 100644
--- a/streams.c
+++ b/streams.c
@@ -323,7 +323,8 @@ peekchar(Term *t)
{
Stream *s = getstream(t);
Rune r = Bgetrune(s->bio);
- Bungetrune(s->bio);
+ if(r != Beof)
+ Bungetrune(s->bio);
return r;
}
@@ -412,11 +413,12 @@ Term *streamproperties(Stream *s)
/* end_of_stream(E) */
if(s->mode == ReadStream){
Rune r = Bgetrune(s->bio);
- Bungetrune(s->bio);
if(r == Beof)
arg = mkatom(L"at");
- else
+ else{
+ Bungetrune(s->bio);
arg = mkatom(L"not");
+ }
data = copyterm(stream, nil);
data->next = mkcompound(L"end_of_stream", 1, arg);
prop = mkcompound(L"prop", 2, data);