Applied patch from Anthony Towns that he posted to Debian bug tracking.

This commit is contained in:
Mark Whitley 2001-03-26 16:47:57 +00:00
parent 049dc25fe7
commit af633757d3
2 changed files with 6 additions and 4 deletions

View File

@ -622,9 +622,10 @@ static void process_file(FILE *file)
if (sed_cmds[i].beg_match && sed_cmds[i].end_match) { if (sed_cmds[i].beg_match && sed_cmds[i].end_match) {
if (still_in_range || regexec(sed_cmds[i].beg_match, line, 0, NULL, 0) == 0) { if (still_in_range || regexec(sed_cmds[i].beg_match, line, 0, NULL, 0) == 0) {
line_altered += do_sed_command(&sed_cmds[i], line); line_altered += do_sed_command(&sed_cmds[i], line);
still_in_range = 1; if (still_in_range && regexec(sed_cmds[i].end_match, line, 0, NULL, 0) == 0)
if (regexec(sed_cmds[i].end_match, line, 0, NULL, 0) == 0)
still_in_range = 0; still_in_range = 0;
else
still_in_range = 1;
} }
} }

5
sed.c
View File

@ -622,9 +622,10 @@ static void process_file(FILE *file)
if (sed_cmds[i].beg_match && sed_cmds[i].end_match) { if (sed_cmds[i].beg_match && sed_cmds[i].end_match) {
if (still_in_range || regexec(sed_cmds[i].beg_match, line, 0, NULL, 0) == 0) { if (still_in_range || regexec(sed_cmds[i].beg_match, line, 0, NULL, 0) == 0) {
line_altered += do_sed_command(&sed_cmds[i], line); line_altered += do_sed_command(&sed_cmds[i], line);
still_in_range = 1; if (still_in_range && regexec(sed_cmds[i].end_match, line, 0, NULL, 0) == 0)
if (regexec(sed_cmds[i].end_match, line, 0, NULL, 0) == 0)
still_in_range = 0; still_in_range = 0;
else
still_in_range = 1;
} }
} }