HCoop
/
bpt
/
guile.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
216d3a1
)
* genio.c (scm_do_read_line): Count lines correctly when the file
author
Jim Blandy
<jimb@red-bean.com>
Sun, 11 Oct 1998 18:42:17 +0000
(18:42 +0000)
committer
Jim Blandy
<jimb@red-bean.com>
Sun, 11 Oct 1998 18:42:17 +0000
(18:42 +0000)
doesn't end in a newline.
libguile/genio.c
patch
|
blob
|
blame
|
history
diff --git
a/libguile/genio.c
b/libguile/genio.c
index
1e5598d
..
6072aa4
100644
(file)
--- a/
libguile/genio.c
+++ b/
libguile/genio.c
@@
-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;