diff options
-rw-r--r-- | editors/sed.c | 6 | ||||
-rw-r--r-- | sed.c | 6 |
2 files changed, 12 insertions, 0 deletions
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 | |||
500 | fputc(line[j], stdout); | 500 | fputc(line[j], stdout); |
501 | } | 501 | } |
502 | 502 | ||
503 | /* if we find a backslash escaped character, print the character */ | ||
504 | else if (replace[i] == '\\') { | ||
505 | ++i; | ||
506 | fputc(replace[i], stdout); | ||
507 | } | ||
508 | |||
503 | /* if we find an unescaped '&' print out the whole matched text. | 509 | /* if we find an unescaped '&' print out the whole matched text. |
504 | * fortunately, regmatch[0] contains the indicies to the whole matched | 510 | * fortunately, regmatch[0] contains the indicies to the whole matched |
505 | * expression (kinda seems like it was designed for just such a | 511 | * expression (kinda seems like it was designed for just such a |
@@ -500,6 +500,12 @@ static void print_subst_w_backrefs(const char *line, const char *replace, regmat | |||
500 | fputc(line[j], stdout); | 500 | fputc(line[j], stdout); |
501 | } | 501 | } |
502 | 502 | ||
503 | /* if we find a backslash escaped character, print the character */ | ||
504 | else if (replace[i] == '\\') { | ||
505 | ++i; | ||
506 | fputc(replace[i], stdout); | ||
507 | } | ||
508 | |||
503 | /* if we find an unescaped '&' print out the whole matched text. | 509 | /* if we find an unescaped '&' print out the whole matched text. |
504 | * fortunately, regmatch[0] contains the indicies to the whole matched | 510 | * fortunately, regmatch[0] contains the indicies to the whole matched |
505 | * expression (kinda seems like it was designed for just such a | 511 | * expression (kinda seems like it was designed for just such a |