aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/sed.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-12-19 21:17:49 -0600
committerRob Landley <rob@landley.net>2014-12-19 21:17:49 -0600
commit95b76828d62afa87eec3d1b1544758a025521912 (patch)
tree3d7210f881931e71036502b5dc19301478e8c696 /toys/pending/sed.c
parentc2d6740a142f1e6b71b9bc320b09575e29867bc2 (diff)
downloadtoybox-95b76828d62afa87eec3d1b1544758a025521912.tar.gz
More sed bugs.
1) Newline in -e after s/// was eaten as "whitespace before flags" 2) \\ needs to be passed through to regex to avoid "trailing \" error and "\\n" is not a newline.
Diffstat (limited to 'toys/pending/sed.c')
-rw-r--r--toys/pending/sed.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/toys/pending/sed.c b/toys/pending/sed.c
index 87038064..070022c4 100644
--- a/toys/pending/sed.c
+++ b/toys/pending/sed.c
@@ -702,7 +702,8 @@ static char *unescape_delimited_string(char **pstr, char *delim, int regex)
// Check escaped end delimiter before printf style escapes.
if (from[1] == d) from++;
- else if (from[1]!='\\') {
+ else if (from[1]=='\\') *(to++) = *(from++);
+ else {
char c = unescape(from[1]);
if (c) {
@@ -827,7 +828,7 @@ static void jewel_of_judgement(char **pline, long len)
for (line++; *line; line++) {
long l;
- if (isspace(*line)) continue;
+ if (isspace(*line) && *line != '\n') continue;
if (0 <= (l = stridx("igp", *line))) corwin->sflags |= 1<<l;
else if (!(corwin->sflags>>3) && 0<(l = strtol(line, &line, 10))) {