diff options
author | bug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-09-14 08:52:53 +0000 |
---|---|---|
committer | bug1 <bug1@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-09-14 08:52:53 +0000 |
commit | 8a090e69fdace86c991a2e62a1f120e654da404d (patch) | |
tree | eabb4bcbc6dee3531caeca881e67509914df6e6c | |
parent | 6f33bdc737739f5f5af91fb932f9df4d8b6f3c67 (diff) | |
download | busybox-w32-8a090e69fdace86c991a2e62a1f120e654da404d.tar.gz busybox-w32-8a090e69fdace86c991a2e62a1f120e654da404d.tar.bz2 busybox-w32-8a090e69fdace86c991a2e62a1f120e654da404d.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
git-svn-id: svn://busybox.net/trunk/busybox@7504 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | editors/sed.c | 5 |
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); |