aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2003-04-09 15:52:32 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2003-04-09 15:52:32 +0000
commitd7fe39b587d78020356eee4636c86e5151634baf (patch)
treef0b0dd29d058aeff43dcb804339aed6bca57a022
parentd87a7ac26947fefa8530559e9eb7f6f49e1b777a (diff)
downloadbusybox-w32-d7fe39b587d78020356eee4636c86e5151634baf.tar.gz
busybox-w32-d7fe39b587d78020356eee4636c86e5151634baf.tar.bz2
busybox-w32-d7fe39b587d78020356eee4636c86e5151634baf.zip
Really fix the 'r' command
-rw-r--r--editors/sed.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/editors/sed.c b/editors/sed.c
index 5ac7889ec..5dd5b2654 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -994,14 +994,17 @@ static void process_file(FILE * file)
994 994
995 case 'r':{ 995 case 'r':{
996 FILE *outfile; 996 FILE *outfile;
997
998 outfile = fopen(sed_cmd->filename, "r"); 997 outfile = fopen(sed_cmd->filename, "r");
999 if (outfile) { 998 if (outfile) {
999 char *line;
1000 while ((line = bb_get_chomped_line_from_file(outfile)) != NULL) {
1001 pattern_space = xrealloc(pattern_space, strlen(line) + strlen(pattern_space) + 2);
1002 strcat(pattern_space, "\n");
1003 strcat(pattern_space, line);
1004 }
1000 bb_xprint_and_close_file(outfile); 1005 bb_xprint_and_close_file(outfile);
1001 } 1006 }
1002 /* else if we couldn't open the output file, 1007
1003 * no biggie, just don't print anything */
1004 altered++;
1005 } 1008 }
1006 break; 1009 break;
1007 case 'q': /* Branch to end of script and quit */ 1010 case 'q': /* Branch to end of script and quit */