From 03fef72fe9ced7bddcd40ea82adb29e262294b8b Mon Sep 17 00:00:00 2001 From: "Tim J. Robbins" Date: Mon, 10 Jun 2002 06:06:20 +0000 Subject: [PATCH] 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. --- usr.bin/sed/process.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c index 4674404d6e01..1ba80f559f54 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,