aboutsummaryrefslogtreecommitdiff
path: root/toys/pending
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-12-14 13:51:28 -0600
committerRob Landley <rob@landley.net>2014-12-14 13:51:28 -0600
commit807a50d89976e2de081d487a54e8e109d49f0a6d (patch)
treeb3cac87669ab535e80d7ff1359f15a2a04582da9 /toys/pending
parent2c23705ab0e3038f0b5bfd3af742d07a3383ed54 (diff)
downloadtoybox-807a50d89976e2de081d487a54e8e109d49f0a6d.tar.gz
Make sed a\ line continuations work properly for different pattern input modes.
Diffstat (limited to 'toys/pending')
-rw-r--r--toys/pending/sed.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/toys/pending/sed.c b/toys/pending/sed.c
index 6c025f0d..fd5352a0 100644
--- a/toys/pending/sed.c
+++ b/toys/pending/sed.c
@@ -913,10 +913,15 @@ append:
reg = extend_string((void *)&corwin, line, reg - (char *)corwin, end);
line += end;
- // Line continuation?
- if (class && reg[-1] == '\\') {
- reg[-1] = 0;
- corwin->hit++;
+ // Line continuation? (Two slightly different input methods, -e with
+ // embedded newline vs -f line by line. Must parse both correctly.)
+ if (class && line[-1] == '\\') {
+ reg[-2] = 0;
+ if (*line && line[1]) {
+ reg -= 2;
+ line++;
+ goto append;
+ } else corwin->hit++;
}
// Commands that take no arguments