1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-09 23:40:29 +02:00

* genio.c (scm_do_read_line): Count lines correctly when the file

doesn't end in a newline.
This commit is contained in:
Jim Blandy 1998-10-11 18:42:17 +00:00
parent 216d3a1e28
commit 5ead5a91d0

View file

@ -182,7 +182,10 @@ scm_do_read_line (port, len)
i = SCM_PTOBNUM (port);
SCM_SYSCALL (s = (scm_ptobs[i].fgets) (port, len));
if (s)
/* If we're not at EOF, and there was a newline at the end of the
string, increment the line counter. */
if (s && *len > 0 && s[*len - 1] == '\n')
SCM_INCLINE(port);
return s;