summaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorMark Whitley2000-07-25 20:48:44 +0000
committerMark Whitley2000-07-25 20:48:44 +0000
commit83e85f6a0837c9cf39146c4798a8583aecba5da3 (patch)
treebe9e446af32c3c02aa20fa52259e9d22245d1368 /editors
parent52681b48dc23bf75609dfdc06933793f21fbc323 (diff)
downloadbusybox-83e85f6a0837c9cf39146c4798a8583aecba5da3.zip
busybox-83e85f6a0837c9cf39146c4798a8583aecba5da3.tar.gz
Modified print_subst_w_backrefs() so it will print backslash escaped
characters properly, just like GNU sed.
Diffstat (limited to 'editors')
-rw-r--r--editors/sed.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/editors/sed.c b/editors/sed.c
index 69a5e03..6654719 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -500,6 +500,12 @@ static void print_subst_w_backrefs(const char *line, const char *replace, regmat
fputc(line[j], stdout);
}
+ /* if we find a backslash escaped character, print the character */
+ else if (replace[i] == '\\') {
+ ++i;
+ fputc(replace[i], stdout);
+ }
+
/* if we find an unescaped '&' print out the whole matched text.
* fortunately, regmatch[0] contains the indicies to the whole matched
* expression (kinda seems like it was designed for just such a