summaryrefslogtreecommitdiffstats
path: root/usr.bin/sed/main.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-06-22 01:42:26 +0000
committertjr <tjr@FreeBSD.org>2002-06-22 01:42:26 +0000
commit2db3395cea1c2763914cba658f77b8ca690ae16b (patch)
tree987e06dd2b502fbd540b7bb43940df7bf1e7e728 /usr.bin/sed/main.c
parent54e88d233485957ffa9107e7397cf759d4182175 (diff)
downloadFreeBSD-src-2db3395cea1c2763914cba658f77b8ca690ae16b.zip
FreeBSD-src-2db3395cea1c2763914cba658f77b8ca690ae16b.tar.gz
Don't store newlines at the end of each line in the hold/pattern spaces,
instead add the newline when the pattern space is printed. Make the `G' and `H' commands add a newline to the space before the data, remove bogus addition of newline from `x' command. PR: 29790, 38195
Diffstat (limited to 'usr.bin/sed/main.c')
-rw-r--r--usr.bin/sed/main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c
index 853003f..e64cfe7 100644
--- a/usr.bin/sed/main.c
+++ b/usr.bin/sed/main.c
@@ -362,6 +362,8 @@ mf_fgets(sp, spflag)
p = fgetln(f, &len);
if (ferror(f))
errx(1, "%s: %s", fname, strerror(errno ? errno : EIO));
+ if (len != 0 && p[len - 1] == '\n')
+ len--;
cspace(sp, p, len, spflag);
linenum++;
OpenPOWER on IntegriCloud