summaryrefslogtreecommitdiffstats
path: root/usr.bin/sed
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-06-10 06:06:20 +0000
committertjr <tjr@FreeBSD.org>2002-06-10 06:06:20 +0000
commit77f74738b6ba56eb73f26167c84d05fd567aa0d1 (patch)
treea350e937964012645904cc85ec698a1d55353141 /usr.bin/sed
parent9508c40671d1c4440e8da9877d59deaf7b60ae07 (diff)
downloadFreeBSD-src-77f74738b6ba56eb73f26167c84d05fd567aa0d1.zip
FreeBSD-src-77f74738b6ba56eb73f26167c84d05fd567aa0d1.tar.gz
Correctly handle global substitutions where the pattern is only "$", the
EOL anchor, when the last input line does not end in a newline character. Picked up by the GNU sed test suite.
Diffstat (limited to 'usr.bin/sed')
-rw-r--r--usr.bin/sed/process.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c
index 4674404..1ba80f5 100644
--- a/usr.bin/sed/process.c
+++ b/usr.bin/sed/process.c
@@ -360,6 +360,9 @@ substitute(cp)
s += match[0].rm_eo;
slen -= match[0].rm_eo;
lastempty = 0;
+ } else if (match[0].rm_so == slen) {
+ s += match[0].rm_so;
+ slen = 0;
} else {
if (match[0].rm_so == 0)
cspace(&SS, s, match[0].rm_so + 1,
OpenPOWER on IntegriCloud