fix CR in read_line_to_codes

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2219 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2008-04-15 11:08:10 +00:00
parent 3edc72b4c1
commit d8488ec48e
1 changed files with 5 additions and 1 deletions

View File

@ -66,7 +66,11 @@ rl_to_codes(Term TEnd, int do_as_binary, int arity)
Term end;
UNLOCK(Stream[sno].streamlock);
if (!(do_as_binary || Stream[sno].status & Eof_Stream_f)) {
buf[sz-1] = '\0';
/* handle CR before NL */
if (sz-2 >= 0 && buf[sz-2] == 13)
buf[sz-2] = '\0';
else
buf[sz-1] = '\0';
}
if (arity == 2)
end = TermNil;