Fix the sed 'r' command
authorGlenn L McGrath <bug1@ihug.co.nz>
Wed, 9 Apr 2003 15:26:14 +0000 (15:26 -0000)
committerGlenn L McGrath <bug1@ihug.co.nz>
Wed, 9 Apr 2003 15:26:14 +0000 (15:26 -0000)
editors/sed.c

index 912318c04c81a502a5fd98ee5c9a3741e29630ec..5ac7889ec7dbd0780c43de7ee06b751b9c7a1acf 100644 (file)
@@ -443,7 +443,6 @@ static int parse_file_cmd(sed_cmd_t * sed_cmd, const char *filecmdstr)
        filenamelen = strcspn(&filecmdstr[idx], semicolon_whitespace);
        sed_cmd->filename = xmalloc(filenamelen + 1);
        safe_strncpy(sed_cmd->filename, &filecmdstr[idx], filenamelen + 1);
-
        return idx + filenamelen;
 }
 
@@ -996,10 +995,10 @@ static void process_file(FILE * file)
                                case 'r':{
                                        FILE *outfile;
 
-                                       puts(pattern_space);
                                        outfile = fopen(sed_cmd->filename, "r");
-                                       if (outfile)
+                                       if (outfile) {
                                                bb_xprint_and_close_file(outfile);
+                                       }
                                        /* else if we couldn't open the output file,
                                         * no biggie, just don't print anything */
                                        altered++;