[BusyBox] Bug Report:BB 1.00 sed

Rob Landley rob at landley.net
Sat Oct 30 06:00:35 UTC 2004


On Friday 29 October 2004 11:37, Hiroshi Ito wrote:
> Hello
>
> Summary:
>  sed's "c" command drops new line when proceses last line of input.
>
> Detailes:
> --  BB's sed ---
> / # echo | sed -e '$ctest'
> test/ #					<= new line is missed

Yup, real problem.  Does this fix it (without breaking anything else you can 
find)?

--- busybox/editors/sed.c	2004-05-26 05:03:33.000000000 -0500
+++ busybox-1.00/editors/sed.c	2004-10-30 00:45:38.106426592 -0500
@@ -908,7 +908,7 @@
 					/* Cut and paste text (replace) */
 					case 'c':
 						/* Only triggers on last line of a matching range. */
-						if (!sed_cmd->in_match) sed_puts(sed_cmd->string,1);
+						if (!sed_cmd->in_match) sed_puts(sed_cmd->string,0);
 						goto discard_line;
 
 					/* Read file, append contents to output */




More information about the busybox mailing list