aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2013-07-08 02:04:44 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2013-07-08 02:07:16 +0200
commit40ab27a225f81b8d1d9b642f293c366f5cc4108f (patch)
treedc7c99ff05bc437d2d9d1a6b42cb5e2e32956424
parente93d15613e827db0d1a7ee7e251b7360bb7ab447 (diff)
downloadbusybox-w32-40ab27a225f81b8d1d9b642f293c366f5cc4108f.tar.gz
busybox-w32-40ab27a225f81b8d1d9b642f293c366f5cc4108f.tar.bz2
busybox-w32-40ab27a225f81b8d1d9b642f293c366f5cc4108f.zip
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.c18
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)
1377/* It is possible to have a command line argument with embedded 1377/* It is possible to have a command line argument with embedded
1378 * newlines. This counts as multiple command lines. 1378 * newlines. This counts as multiple command lines.
1379 * However, newline can be escaped: 's/e/z\<newline>z/' 1379 * However, newline can be escaped: 's/e/z\<newline>z/'
1380 * We check for this. 1380 * add_cmd() handles this.
1381 */ 1381 */
1382 1382
1383static void add_cmd_block(char *cmdstr) 1383static void add_cmd_block(char *cmdstr)
@@ -1387,22 +1387,8 @@ static void add_cmd_block(char *cmdstr)
1387 cmdstr = sv = xstrdup(cmdstr); 1387 cmdstr = sv = xstrdup(cmdstr);
1388 do { 1388 do {
1389 eol = strchr(cmdstr, '\n'); 1389 eol = strchr(cmdstr, '\n');
1390 next: 1390 if (eol)
1391 if (eol) {
1392 /* Count preceding slashes */
1393 int slashes = 0;
1394 char *sl = eol;
1395
1396 while (sl != cmdstr && *--sl == '\\')
1397 slashes++;
1398 /* Odd number of preceding slashes - newline is escaped */
1399 if (slashes & 1) {
1400 overlapping_strcpy(eol - 1, eol);
1401 eol = strchr(eol, '\n');
1402 goto next;
1403 }
1404 *eol = '\0'; 1391 *eol = '\0';
1405 }
1406 add_cmd(cmdstr); 1392 add_cmd(cmdstr);
1407 cmdstr = eol + 1; 1393 cmdstr = eol + 1;
1408 } while (eol); 1394 } while (eol);