...And now that we're chomping lines, we need to re-add the newline later...
This commit is contained in:
parent
9de2659264
commit
dd527d3c62
@ -637,7 +637,7 @@ static int do_sed_command(const struct sed_cmd *sed_cmd, const char *line)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'a':
|
case 'a':
|
||||||
fputs(line, stdout);
|
puts(line);
|
||||||
fputs(sed_cmd->editline, stdout);
|
fputs(sed_cmd->editline, stdout);
|
||||||
altered++;
|
altered++;
|
||||||
break;
|
break;
|
||||||
@ -653,7 +653,7 @@ static int do_sed_command(const struct sed_cmd *sed_cmd, const char *line)
|
|||||||
|
|
||||||
case 'r': {
|
case 'r': {
|
||||||
FILE *file;
|
FILE *file;
|
||||||
fputs(line, stdout);
|
puts(line);
|
||||||
file = fopen(sed_cmd->filename, "r");
|
file = fopen(sed_cmd->filename, "r");
|
||||||
if (file)
|
if (file)
|
||||||
print_file(file);
|
print_file(file);
|
||||||
@ -724,7 +724,7 @@ static void process_file(FILE *file)
|
|||||||
* line was altered (via a 'd'elete or 's'ubstitution), in which case
|
* line was altered (via a 'd'elete or 's'ubstitution), in which case
|
||||||
* the altered line was already printed */
|
* the altered line was already printed */
|
||||||
if (!be_quiet && !line_altered)
|
if (!be_quiet && !line_altered)
|
||||||
fputs(line, stdout);
|
puts(line);
|
||||||
|
|
||||||
free(line);
|
free(line);
|
||||||
}
|
}
|
||||||
|
6
sed.c
6
sed.c
@ -637,7 +637,7 @@ static int do_sed_command(const struct sed_cmd *sed_cmd, const char *line)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'a':
|
case 'a':
|
||||||
fputs(line, stdout);
|
puts(line);
|
||||||
fputs(sed_cmd->editline, stdout);
|
fputs(sed_cmd->editline, stdout);
|
||||||
altered++;
|
altered++;
|
||||||
break;
|
break;
|
||||||
@ -653,7 +653,7 @@ static int do_sed_command(const struct sed_cmd *sed_cmd, const char *line)
|
|||||||
|
|
||||||
case 'r': {
|
case 'r': {
|
||||||
FILE *file;
|
FILE *file;
|
||||||
fputs(line, stdout);
|
puts(line);
|
||||||
file = fopen(sed_cmd->filename, "r");
|
file = fopen(sed_cmd->filename, "r");
|
||||||
if (file)
|
if (file)
|
||||||
print_file(file);
|
print_file(file);
|
||||||
@ -724,7 +724,7 @@ static void process_file(FILE *file)
|
|||||||
* line was altered (via a 'd'elete or 's'ubstitution), in which case
|
* line was altered (via a 'd'elete or 's'ubstitution), in which case
|
||||||
* the altered line was already printed */
|
* the altered line was already printed */
|
||||||
if (!be_quiet && !line_altered)
|
if (!be_quiet && !line_altered)
|
||||||
fputs(line, stdout);
|
puts(line);
|
||||||
|
|
||||||
free(line);
|
free(line);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user