summaryrefslogtreecommitdiff
path: root/editors/sed.c
diff options
context:
space:
mode:
authorGlenn L McGrath2003-08-30 04:35:07 +0000
committerGlenn L McGrath2003-08-30 04:35:07 +0000
commit9b04f1841eb4ef9b88e525796cd7230f6c3c1c6e (patch)
tree0182f3773ca809ef13af1dc478a6dcb63b367dea /editors/sed.c
parent72f5f02184f8b1064e3dd9c8d33e65b64830340c (diff)
downloadbusybox-9b04f1841eb4ef9b88e525796cd7230f6c3c1c6e.zip
busybox-9b04f1841eb4ef9b88e525796cd7230f6c3c1c6e.tar.gz
Fix the substitution print subcommand, it should only print if its
own substitution matched, not previous ones. e.g echo fooba | sed -n 's/foo//;s/bar/found/p' shouldnt print anything
Diffstat (limited to 'editors/sed.c')
-rw-r--r--editors/sed.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/editors/sed.c b/editors/sed.c
index 6beba06..b06d5a8 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -839,7 +839,6 @@ static void process_file(FILE * file)
still_in_range || ((sed_cmd->beg_line == -1)
&& (next_line == NULL))
);
-
if (sed_cmd->cmd == '{') {
block_mask = block_mask & matched;
}
@@ -925,7 +924,7 @@ static void process_file(FILE * file)
}
}
#endif
- altered |= substituted;
+ altered = substituted;
if (!be_quiet && altered && ((sed_cmd->next == NULL)
|| (sed_cmd->next->cmd != 's'))) {
force_print = 1;