aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2003-09-14 08:52:53 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2003-09-14 08:52:53 +0000
commitedc388cf4ef381282d13e2873694e3c9032214e4 (patch)
treeeabb4bcbc6dee3531caeca881e67509914df6e6c /editors
parent3fe475677a54fff6ce8a39e1d4a7e3d358aeed18 (diff)
downloadbusybox-w32-edc388cf4ef381282d13e2873694e3c9032214e4.tar.gz
busybox-w32-edc388cf4ef381282d13e2873694e3c9032214e4.tar.bz2
busybox-w32-edc388cf4ef381282d13e2873694e3c9032214e4.zip
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
Diffstat (limited to 'editors')
-rw-r--r--editors/sed.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/editors/sed.c b/editors/sed.c
index 2be4ed174..63d5581f0 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -915,8 +915,7 @@ static void process_file(FILE * file)
915 } 915 }
916 } 916 }
917#endif 917#endif
918 altered = substituted; 918 if (!be_quiet && substituted && ((sed_cmd->next == NULL)
919 if (!be_quiet && altered && ((sed_cmd->next == NULL)
920 || (sed_cmd->next->cmd != 's'))) { 919 || (sed_cmd->next->cmd != 's'))) {
921 force_print = 1; 920 force_print = 1;
922 } 921 }
@@ -1105,7 +1104,7 @@ static void process_file(FILE * file)
1105 /* we will print the line unless we were told to be quiet or if the 1104 /* we will print the line unless we were told to be quiet or if the
1106 * line was altered (via a 'd'elete or 's'ubstitution), in which case 1105 * line was altered (via a 'd'elete or 's'ubstitution), in which case
1107 * the altered line was already printed */ 1106 * the altered line was already printed */
1108 if ((!be_quiet && !altered) || force_print) { 1107 if ((!be_quiet && !altered && !substituted) || force_print) {
1109 puts(pattern_space); 1108 puts(pattern_space);
1110 } 1109 }
1111 free(pattern_space); 1110 free(pattern_space);