mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-10 07:50:24 +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:
parent
216d3a1e28
commit
5ead5a91d0
1 changed files with 4 additions and 1 deletions
|
@ -182,7 +182,10 @@ scm_do_read_line (port, len)
|
||||||
|
|
||||||
i = SCM_PTOBNUM (port);
|
i = SCM_PTOBNUM (port);
|
||||||
SCM_SYSCALL (s = (scm_ptobs[i].fgets) (port, len));
|
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);
|
SCM_INCLINE(port);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue