diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2003-04-09 15:26:14 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2003-04-09 15:26:14 +0000 |
commit | d87a7ac26947fefa8530559e9eb7f6f49e1b777a (patch) | |
tree | a31ed3a97cbaa6f69ae9093acb79d3f4862fc036 | |
parent | 2410386611e104ee4e078b2182e3b9b2f9f3adff (diff) | |
download | busybox-w32-d87a7ac26947fefa8530559e9eb7f6f49e1b777a.tar.gz busybox-w32-d87a7ac26947fefa8530559e9eb7f6f49e1b777a.tar.bz2 busybox-w32-d87a7ac26947fefa8530559e9eb7f6f49e1b777a.zip |
Fix the sed 'r' command
-rw-r--r-- | editors/sed.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/editors/sed.c b/editors/sed.c index 912318c04..5ac7889ec 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -443,7 +443,6 @@ static int parse_file_cmd(sed_cmd_t * sed_cmd, const char *filecmdstr) | |||
443 | filenamelen = strcspn(&filecmdstr[idx], semicolon_whitespace); | 443 | filenamelen = strcspn(&filecmdstr[idx], semicolon_whitespace); |
444 | sed_cmd->filename = xmalloc(filenamelen + 1); | 444 | sed_cmd->filename = xmalloc(filenamelen + 1); |
445 | safe_strncpy(sed_cmd->filename, &filecmdstr[idx], filenamelen + 1); | 445 | safe_strncpy(sed_cmd->filename, &filecmdstr[idx], filenamelen + 1); |
446 | |||
447 | return idx + filenamelen; | 446 | return idx + filenamelen; |
448 | } | 447 | } |
449 | 448 | ||
@@ -996,10 +995,10 @@ static void process_file(FILE * file) | |||
996 | case 'r':{ | 995 | case 'r':{ |
997 | FILE *outfile; | 996 | FILE *outfile; |
998 | 997 | ||
999 | puts(pattern_space); | ||
1000 | outfile = fopen(sed_cmd->filename, "r"); | 998 | outfile = fopen(sed_cmd->filename, "r"); |
1001 | if (outfile) | 999 | if (outfile) { |
1002 | bb_xprint_and_close_file(outfile); | 1000 | bb_xprint_and_close_file(outfile); |
1001 | } | ||
1003 | /* else if we couldn't open the output file, | 1002 | /* else if we couldn't open the output file, |
1004 | * no biggie, just don't print anything */ | 1003 | * no biggie, just don't print anything */ |
1005 | altered++; | 1004 | altered++; |