summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn L McGrath2003-09-14 08:52:53 +0000
committerGlenn L McGrath2003-09-14 08:52:53 +0000
commitedc388cf4ef381282d13e2873694e3c9032214e4 (patch)
treeeabb4bcbc6dee3531caeca881e67509914df6e6c
parent3fe475677a54fff6ce8a39e1d4a7e3d358aeed18 (diff)
downloadbusybox-edc388cf4ef381282d13e2873694e3c9032214e4.zip
busybox-edc388cf4ef381282d13e2873694e3c9032214e4.tar.gz
The previous fix for 's/a/1/;s/b/2/;t one;p;:one;p' broke the case of
echo fooba | ./busybox sed -n 's/foo//;s/bar/found/p' I really need to start adding these tests to the testsuite. keep the substituted and altered flags seperate
-rw-r--r--editors/sed.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/editors/sed.c b/editors/sed.c
index 2be4ed1..63d5581 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -915,8 +915,7 @@ static void process_file(FILE * file)
}
}
#endif
- altered = substituted;
- if (!be_quiet && altered && ((sed_cmd->next == NULL)
+ if (!be_quiet && substituted && ((sed_cmd->next == NULL)
|| (sed_cmd->next->cmd != 's'))) {
force_print = 1;
}
@@ -1105,7 +1104,7 @@ static void process_file(FILE * file)
/* we will print the line unless we were told to be quiet or if the
* line was altered (via a 'd'elete or 's'ubstitution), in which case
* the altered line was already printed */
- if ((!be_quiet && !altered) || force_print) {
+ if ((!be_quiet && !altered && !substituted) || force_print) {
puts(pattern_space);
}
free(pattern_space);