From 678fec509dde47fe561de515df7e600274c38380 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" <pfg@FreeBSD.org> Date: Wed, 6 Apr 2016 00:55:39 +0000 Subject: [PATCH] Fix sed functions 'i' and 'a' from discarding leading white space. This appears to be implementation dependent but convenient and makes our sed behave more like GNU sed. Given that it is not the historic behavior, bump FreeBSD_version should userland/ports somehow depend on it. Obtained from: NetBSD (bin/49872) Reviewed by: bdrewery PR: 208554 Merge after: NEVER --- sys/sys/param.h | 2 +- usr.bin/sed/compile.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index 987453c418a6..2f6eb7af1f76 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100104 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100105 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/usr.bin/sed/compile.c b/usr.bin/sed/compile.c index 68cbbc54f22b..2d7f8d2f6e73 100644 --- a/usr.bin/sed/compile.c +++ b/usr.bin/sed/compile.c @@ -730,7 +730,7 @@ compile_tr(char *p, struct s_tr **py) } /* - * Compile the text following an a or i command. + * Compile the text following an a, c, or i command. */ static char * compile_text(void) @@ -746,7 +746,6 @@ compile_text(void) while (cu_fgets(lbuf, sizeof(lbuf), NULL)) { op = s = text + size; p = lbuf; - EATSPACE(); for (esc_nl = 0; *p != '\0'; p++) { if (*p == '\\' && p[1] != '\0' && *++p == '\n') esc_nl = 1;