[BusyBox-cvs] busybox/editors sed.c,1.147,1.148

Glenn McGrath bug1 at busybox.net
Tue Sep 16 01:46:37 UTC 2003


Update of /var/cvs/busybox/editors
In directory winder:/tmp/cvs-serv31015/editors

Modified Files:
	sed.c 
Log Message:
Fix a bug that creapt in recently with substitution subprinting, and add 
a test for it.


Index: sed.c
===================================================================
RCS file: /var/cvs/busybox/editors/sed.c,v
retrieving revision 1.147
retrieving revision 1.148
diff -u -d -r1.147 -r1.148
--- sed.c	15 Sep 2003 12:07:46 -0000	1.147
+++ sed.c	16 Sep 2003 01:46:34 -0000	1.148
@@ -914,7 +914,6 @@
 #endif
 					/* we print the pattern_space once, unless we were told to be quiet */
 					substituted |= do_subst_command(sed_cmd, &pattern_space);
-
 #ifdef CONFIG_FEATURE_SED_EMBEDED_NEWLINE
 					/* undo HACK: escape newlines twice so regex can match them */
 					{
@@ -930,10 +929,10 @@
 							|| (sed_cmd->next->cmd != 's'))) {
 						force_print = 1;
 					}
-
 					/* we also print the line if we were given the 'p' flag
 					 * (this is quite possibly the second printing) */
-					if ((sed_cmd->sub_p) && altered) {
+//					if ((sed_cmd->sub_p) && (!altered || substituted)) {
+					if ((sed_cmd->sub_p) && (altered || substituted)) {
 						puts(pattern_space);
 					}
 					break;




More information about the busybox-cvs mailing list