diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-12-23 08:53:51 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-12-23 08:53:51 +0000 |
commit | 1041c6bf1fd3d35d0c90e64e7575f6699a0b8189 (patch) | |
tree | 2489e09309a1428000062965b31e4d62d406ee18 | |
parent | fc0d2a2206434cd8e2b8fa61e273854cb71db342 (diff) | |
download | busybox-w32-1041c6bf1fd3d35d0c90e64e7575f6699a0b8189.tar.gz busybox-w32-1041c6bf1fd3d35d0c90e64e7575f6699a0b8189.tar.bz2 busybox-w32-1041c6bf1fd3d35d0c90e64e7575f6699a0b8189.zip |
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.
git-svn-id: svn://busybox.net/trunk/busybox@8161 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | editors/sed.c | 6 |
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) | |||
746 | restart: | 746 | restart: |
747 | /* for every line, go through all the commands */ | 747 | /* for every line, go through all the commands */ |
748 | for (sed_cmd = sed_cmd_head.next; sed_cmd; sed_cmd = sed_cmd->next) { | 748 | for (sed_cmd = sed_cmd_head.next; sed_cmd; sed_cmd = sed_cmd->next) { |
749 | int matched; | 749 | int old_matched, matched; |
750 | |||
751 | old_matched = sed_cmd->in_match; | ||
750 | 752 | ||
751 | /* Determine if this command matches this line: */ | 753 | /* Determine if this command matches this line: */ |
752 | 754 | ||
@@ -783,7 +785,7 @@ restart: | |||
783 | : sed_cmd->end_line<=linenum | 785 | : sed_cmd->end_line<=linenum |
784 | : !sed_cmd->end_match) | 786 | : !sed_cmd->end_match) |
785 | /* or does this line matches our last address regex */ | 787 | /* or does this line matches our last address regex */ |
786 | || (sed_cmd->end_match && (regexec(sed_cmd->end_match, pattern_space, 0, NULL, 0) == 0)) | 788 | || (sed_cmd->end_match && old_matched && (regexec(sed_cmd->end_match, pattern_space, 0, NULL, 0) == 0)) |
787 | ); | 789 | ); |
788 | } | 790 | } |
789 | 791 | ||