[BusyBox-cvs] busybox/editors sed.c,1.138,1.139
Glenn McGrath
bug1 at busybox.net
Sun Sep 14 08:52:57 UTC 2003
Update of /var/cvs/busybox/editors
In directory winder:/tmp/cvs-serv22782/editors
Modified Files:
sed.c
Log Message:
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
Index: sed.c
===================================================================
RCS file: /var/cvs/busybox/editors/sed.c,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- sed.c 14 Sep 2003 07:59:28 -0000 1.138
+++ sed.c 14 Sep 2003 08:52:53 -0000 1.139
@@ -915,8 +915,7 @@
}
}
#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 @@
/* 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);
More information about the busybox-cvs
mailing list