diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-07-08 04:04:44 +0400 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-07-08 04:07:16 +0400 |
commit | 40ab27a225f81b8d1d9b642f293c366f5cc4108f (patch) | |
tree | dc7c99ff05bc437d2d9d1a6b42cb5e2e32956424 | |
parent | e93d15613e827db0d1a7ee7e251b7360bb7ab447 (diff) |
sed: remove now-redundant backslash-newline handling
4b0bb9e0fd9ec06e9e61b1a1527ace99ea9fe571 added this code in 2007,
then in a2215b98f7d65bc613b9c8f008d79672402c6a07 more general fix
was added.
function old new delta
add_cmd_block 98 58 -40
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | editors/sed.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/editors/sed.c b/editors/sed.c index f90bc5449..e625a0965 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -1377,7 +1377,7 @@ static void process_files(void) /* It is possible to have a command line argument with embedded * newlines. This counts as multiple command lines. * However, newline can be escaped: 's/e/z\<newline>z/' - * We check for this. + * add_cmd() handles this. */ static void add_cmd_block(char *cmdstr) @@ -1387,22 +1387,8 @@ static void add_cmd_block(char *cmdstr) cmdstr = sv = xstrdup(cmdstr); do { eol = strchr(cmdstr, '\n'); - next: - if (eol) { - /* Count preceding slashes */ - int slashes = 0; - char *sl = eol; - - while (sl != cmdstr && *--sl == '\\') - slashes++; - /* Odd number of preceding slashes - newline is escaped */ - if (slashes & 1) { - overlapping_strcpy(eol - 1, eol); - eol = strchr(eol, '\n'); - goto next; - } + if (eol) *eol = '\0'; - } add_cmd(cmdstr); cmdstr = eol + 1; } while (eol); |