aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editors/sed.c5
-rw-r--r--sed.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/editors/sed.c b/editors/sed.c
index a18f6e522..897c290d5 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -622,9 +622,10 @@ static void process_file(FILE *file)
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) {
line_altered += do_sed_command(&sed_cmds[i], line);
- still_in_range = 1;
- if (regexec(sed_cmds[i].end_match, line, 0, NULL, 0) == 0)
+ if (still_in_range && regexec(sed_cmds[i].end_match, line, 0, NULL, 0) == 0)
still_in_range = 0;
+ else
+ still_in_range = 1;
}
}
diff --git a/sed.c b/sed.c
index a18f6e522..897c290d5 100644
--- a/sed.c
+++ b/sed.c
@@ -622,9 +622,10 @@ static void process_file(FILE *file)
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) {
line_altered += do_sed_command(&sed_cmds[i], line);
- still_in_range = 1;
- if (regexec(sed_cmds[i].end_match, line, 0, NULL, 0) == 0)
+ if (still_in_range && regexec(sed_cmds[i].end_match, line, 0, NULL, 0) == 0)
still_in_range = 0;
+ else
+ still_in_range = 1;
}
}