aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-12-23 08:53:51 +0000
committerEric Andersen <andersen@codepoet.org>2003-12-23 08:53:51 +0000
commit52a3c2726ef9dc2c350fe761e41bf8e02444392e (patch)
tree2489e09309a1428000062965b31e4d62d406ee18 /editors
parentb89fcd44308b7551ca239c31fe26df725377f75f (diff)
downloadbusybox-52a3c2726ef9dc2c350fe761e41bf8e02444392e.tar.gz
Patch from Matt Kraai:
sed is broken: busybox sed -n '/^a/,/^a/p' >output <<EOF a b a b EOF cmp -s output - <<EOF a b a EOF The attached patch fixes it.
Diffstat (limited to 'editors')
-rw-r--r--editors/sed.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/editors/sed.c b/editors/sed.c
index 4552af6c3..5f58fe27a 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -746,7 +746,9 @@ static void process_file(FILE * file)
restart:
/* for every line, go through all the commands */
for (sed_cmd = sed_cmd_head.next; sed_cmd; sed_cmd = sed_cmd->next) {
- int matched;
+ int old_matched, matched;
+
+ old_matched = sed_cmd->in_match;
/* Determine if this command matches this line: */
@@ -783,7 +785,7 @@ restart:
: sed_cmd->end_line<=linenum
: !sed_cmd->end_match)
/* or does this line matches our last address regex */
- || (sed_cmd->end_match && (regexec(sed_cmd->end_match, pattern_space, 0, NULL, 0) == 0))
+ || (sed_cmd->end_match && old_matched && (regexec(sed_cmd->end_match, pattern_space, 0, NULL, 0) == 0))
);
}