diff options
| author | bug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-08-30 04:35:07 +0000 |
|---|---|---|
| committer | bug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-08-30 04:35:07 +0000 |
| commit | 6253aa040a7dc8397c23978c8ea5e0081c080e82 (patch) | |
| tree | 0182f3773ca809ef13af1dc478a6dcb63b367dea | |
| parent | a034d2bf241ff274045da380a5a0bb5d3c2a2f70 (diff) | |
| download | busybox-w32-6253aa040a7dc8397c23978c8ea5e0081c080e82.tar.gz busybox-w32-6253aa040a7dc8397c23978c8ea5e0081c080e82.tar.bz2 busybox-w32-6253aa040a7dc8397c23978c8ea5e0081c080e82.zip | |
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
git-svn-id: svn://busybox.net/trunk/busybox@7297 69ca8d6d-28ef-0310-b511-8ec308f3f277
| -rw-r--r-- | editors/sed.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/editors/sed.c b/editors/sed.c index 6beba0661..b06d5a8d8 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
| @@ -839,7 +839,6 @@ static void process_file(FILE * file) | |||
| 839 | still_in_range || ((sed_cmd->beg_line == -1) | 839 | still_in_range || ((sed_cmd->beg_line == -1) |
| 840 | && (next_line == NULL)) | 840 | && (next_line == NULL)) |
| 841 | ); | 841 | ); |
| 842 | |||
| 843 | if (sed_cmd->cmd == '{') { | 842 | if (sed_cmd->cmd == '{') { |
| 844 | block_mask = block_mask & matched; | 843 | block_mask = block_mask & matched; |
| 845 | } | 844 | } |
| @@ -925,7 +924,7 @@ static void process_file(FILE * file) | |||
| 925 | } | 924 | } |
| 926 | } | 925 | } |
| 927 | #endif | 926 | #endif |
| 928 | altered |= substituted; | 927 | altered = substituted; |
| 929 | if (!be_quiet && altered && ((sed_cmd->next == NULL) | 928 | if (!be_quiet && altered && ((sed_cmd->next == NULL) |
| 930 | || (sed_cmd->next->cmd != 's'))) { | 929 | || (sed_cmd->next->cmd != 's'))) { |
| 931 | force_print = 1; | 930 | force_print = 1; |
