summaryrefslogtreecommitdiffstats
path: root/usr.bin/sed
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-11-09 18:00:50 +0000
committerpfg <pfg@FreeBSD.org>2016-11-09 18:00:50 +0000
commitae76dae508b95eb0ab4a3b9bd65333a903686046 (patch)
tree6c733174b154d914cb0224e342176c71c57e8f0a /usr.bin/sed
parent755f2814f495aab6798d1018750bbd70430fff17 (diff)
downloadFreeBSD-src-ae76dae508b95eb0ab4a3b9bd65333a903686046.zip
FreeBSD-src-ae76dae508b95eb0ab4a3b9bd65333a903686046.tar.gz
MFC r308314:
sed(1): add LEGACY_BSDSED_COMPAT compile-time flag. In r297602, which included a __FreeBSD_version bump to 1100105, we changed sed 'i' and 'a' from discarding whitespaces to conform with what GNU and sysvish sed do. There are arguments in favor of keeping the old behavior but the new behavior is also useful for migration purposes. It seems important to at least consider the case of developers depending on the previous behavior so add a CFLAG to enable the old behavior. PR: 213474
Diffstat (limited to 'usr.bin/sed')
-rw-r--r--usr.bin/sed/compile.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/usr.bin/sed/compile.c b/usr.bin/sed/compile.c
index b5bc3e2..3e79097 100644
--- a/usr.bin/sed/compile.c
+++ b/usr.bin/sed/compile.c
@@ -746,6 +746,9 @@ compile_text(void)
while (cu_fgets(lbuf, sizeof(lbuf), NULL)) {
op = s = text + size;
p = lbuf;
+#ifdef LEGACY_BSDSED_COMPAT
+ EATSPACE();
+#endif
for (esc_nl = 0; *p != '\0'; p++) {
if (*p == '\\' && p[1] != '\0' && *++p == '\n')
esc_nl = 1;
OpenPOWER on IntegriCloud