From 29eb5664483883863fd6b72340b55b1c71e13b83 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 15 Mar 2006 19:35:30 +0000 Subject: [PATCH] Melchior found the first bug -- report EOF as nil in readln(). --- simgear/nasal/iolib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simgear/nasal/iolib.c b/simgear/nasal/iolib.c index 9d65fa1e..d90654b6 100644 --- a/simgear/nasal/iolib.c +++ b/simgear/nasal/iolib.c @@ -174,7 +174,7 @@ static naRef f_readln(naContext ctx, naRef me, int argc, naRef* args) buf[i++] = c; if(i >= sz) buf = naRealloc(buf, sz *= 2); } - result = naStr_fromdata(naNewString(ctx), buf, i); + result = c == EOF ? naNil() : naStr_fromdata(naNewString(ctx), buf, i); naFree(buf); return result; } -- 2.39.5