diff options
author | Matt Kraai | 2001-10-23 21:12:07 +0000 |
---|---|---|
committer | Matt Kraai | 2001-10-23 21:12:07 +0000 |
commit | 8470b9a85c4f202e0167bfba13460d89a9da876c (patch) | |
tree | 8c0ba50bb19cb31060546b524ef3f95f9a936528 /sed.c | |
parent | 6ccdd8c122ea6ccfc1360d19c0066c1037d8ac02 (diff) | |
download | busybox-8470b9a85c4f202e0167bfba13460d89a9da876c.zip busybox-8470b9a85c4f202e0167bfba13460d89a9da876c.tar.gz |
Fix empty line substitutions (noted by Joshua Hudson).
Diffstat (limited to 'sed.c')
-rw-r--r-- | sed.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -589,8 +589,8 @@ static int do_subst_command(const struct sed_cmd *sed_cmd, char **line) /* and now, as long as we've got a line to try matching and if we can match * the search string, we make substitutions */ - while (*hackline && (regexec(sed_cmd->sub_match, hackline, - sed_cmd->num_backrefs+1, regmatch, 0) == 0) ) { + while ((*hackline || !altered) && (regexec(sed_cmd->sub_match, hackline, + sed_cmd->num_backrefs+1, regmatch, 0) != REG_NOMATCH) ) { int i; /* print everything before the match */ |