Mercurial > hg > toybox
changeset 1616:7d60ceb548d7 draft
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.
author | Rob Landley <rob@landley.net> |
---|---|
date | Fri, 19 Dec 2014 21:17:49 -0600 |
parents | 95b6ae6498fd |
children | 942e1cacb5b3 |
files | toys/pending/sed.c |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/toys/pending/sed.c Thu Dec 18 11:13:35 2014 -0600 +++ b/toys/pending/sed.c Fri Dec 19 21:17:49 2014 -0600 @@ -702,7 +702,8 @@ // 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 @@ 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))) {