X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=sed.c;h=897c290d5cf73ce6b23420ab856ebe798787aad4;hb=a2a978ae23e267c24eb7b11662afdcc9ea47e789;hp=0f0f4a28d19829907293ab7335e1fe544aee2ad8;hpb=b50da53e0c6e07bbf69ac7ec1730087edf6815a1;p=oweals%2Fbusybox.git diff --git a/sed.c b/sed.c index 0f0f4a28d..897c290d5 100644 --- a/sed.c +++ b/sed.c @@ -154,6 +154,9 @@ static int get_address(struct sed_cmd *sed_cmd, const char *str, int *line, rege { char *my_str = strdup(str); int idx = 0; + char olddelimiter; + olddelimiter = sed_cmd->delimiter; + sed_cmd->delimiter = '/'; if (isdigit(my_str[idx])) { do { @@ -182,6 +185,7 @@ static int get_address(struct sed_cmd *sed_cmd, const char *str, int *line, rege } free(my_str); + sed_cmd->delimiter = olddelimiter; return idx; } @@ -618,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; } }