Melchior found the first bug -- report EOF as nil in readln().

This commit is contained in:
andy 2006-03-15 19:35:30 +00:00
parent a770d2a972
commit 29eb566448

View File

@ -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;
}