lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> I just noticed that io:lines() does not cope with \0 in the lines, and thus just returns truncated lines (lua-5.2.3, but legacy 5.1 likewise).
> 
> May I suggest replacing the call to fgets in src/liolib.c so that we can read lines with \0 data?

At least in Mac OS X and Linux fgets works just fine: it reads bytes
until it sees \n, as promised in its man page. Unfortunately, fgets does
not tell you how many bytes it has read and you're left with having to
call strlen to find this out. I guess we could avoid strlen and use
memchr instead.

How did you propose to replace fgets?