summaryrefslogtreecommitdiff
path: root/examples/loadables/cut.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/loadables/cut.c')
-rw-r--r--examples/loadables/cut.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/loadables/cut.c b/examples/loadables/cut.c
index ed4972d2..48f80047 100644
--- a/examples/loadables/cut.c
+++ b/examples/loadables/cut.c
@@ -417,7 +417,9 @@ cutfile (v, list, ops)
while ((n = zgetline (fd, &line, &llen, '\n', unbuffered_read)) != -1)
{
QUIT;
- cutline (v, line, ops); /* can modify line */
+ if (line[n] == '\n')
+ line[n] = '\0'; /* cutline expects no newline terminator */
+ cutline (v, line, ops); /* can modify line */
}
if (fd > 0)
close (fd);