From: Mark Whitley Date: Tue, 25 Jul 2000 20:48:44 +0000 (-0000) Subject: Modified print_subst_w_backrefs() so it will print backslash escaped X-Git-Tag: 0_47~196 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=83e85f6a0837c9cf39146c4798a8583aecba5da3;p=oweals%2Fbusybox.git Modified print_subst_w_backrefs() so it will print backslash escaped characters properly, just like GNU sed. --- diff --git a/editors/sed.c b/editors/sed.c index 69a5e0324..665471913 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 diff --git a/sed.c b/sed.c index 69a5e0324..665471913 100644 --- a/sed.c +++ b/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