Modified print_subst_w_backrefs() so it will print backslash escaped
authorMark Whitley <markw@lineo.com>
Tue, 25 Jul 2000 20:48:44 +0000 (20:48 -0000)
committerMark Whitley <markw@lineo.com>
Tue, 25 Jul 2000 20:48:44 +0000 (20:48 -0000)
characters properly, just like GNU sed.

editors/sed.c
sed.c

index 69a5e032477864aee304b9192d61fbc0c9c372e0..665471913d72f03fdedb2b1e664d1eab2024286d 100644 (file)
@@ -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 69a5e032477864aee304b9192d61fbc0c9c372e0..665471913d72f03fdedb2b1e664d1eab2024286d 100644 (file)
--- 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