From c18ce373a21f72b23259c9c15503ac8800d605c7 Mon Sep 17 00:00:00 2001 From: Glenn L McGrath Date: Sat, 13 Sep 2003 06:57:39 +0000 Subject: [PATCH] Fix the following testcase by storing the state of the adress match with the command. # cat strings a b c d e f g # ./busybox sed '1,2d;4,$d' beg_match, pattern_space, 0, NULL, 0) == 0)) || /* we are currently within the beginning & ending address range */ - still_in_range || ((sed_cmd->beg_line == -1) + sed_cmd->still_in_range || ((sed_cmd->beg_line == -1) && (next_line == NULL)) ); if (sed_cmd->cmd == '{') { @@ -1077,7 +1079,7 @@ static void process_file(FILE * file) /* If only one address */ /* we were in the middle of our address range (this * isn't the first time through) and.. */ - || ((still_in_range == 1) + || ((sed_cmd->still_in_range == 1) /* this line number is the last address we're looking for or... */ && ((sed_cmd->end_line > 0 && (sed_cmd->end_line == linenum)) @@ -1086,10 +1088,10 @@ static void process_file(FILE * file) && (regexec(sed_cmd->end_match, pattern_space, 0, NULL, 0) == 0))))) { /* we're out of our address range */ - still_in_range = 0; + sed_cmd->still_in_range = 0; } else { /* didn't hit the exit? then we're still in the middle of an address range */ - still_in_range = 1; + sed_cmd->still_in_range = 1; } }