[BusyBox-cvs] busybox/editors sed.c,1.126,1.127

Glenn McGrath bug1 at busybox.net
Wed Apr 9 15:52:35 UTC 2003


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

Modified Files:
	sed.c 
Log Message:
Really fix the 'r' command


Index: sed.c
===================================================================
RCS file: /var/cvs/busybox/editors/sed.c,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- sed.c	9 Apr 2003 15:26:14 -0000	1.126
+++ sed.c	9 Apr 2003 15:52:32 -0000	1.127
@@ -994,14 +994,17 @@
 
 				case 'r':{
 					FILE *outfile;
-
 					outfile = fopen(sed_cmd->filename, "r");
 					if (outfile) {
+						char *line;
+						while ((line = bb_get_chomped_line_from_file(outfile)) != NULL) {
+							pattern_space = xrealloc(pattern_space, strlen(line) + strlen(pattern_space) + 2);
+							strcat(pattern_space, "\n");
+							strcat(pattern_space, line);
+						}
 						bb_xprint_and_close_file(outfile);
 					}
-					/* else if we couldn't open the output file,
-					 * no biggie, just don't print anything */
-					altered++;
+
 				}
 					break;
 				case 'q':	/* Branch to end of script and quit */



More information about the busybox-cvs mailing list