summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2012-04-24 17:27:34 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2012-04-24 17:27:34 (GMT)
commitb84dafb5e57462c91df48456dfc5bb7c811e7a24 (patch)
tree2a512a6d2e9b8c8b0da5b0a981a9f0b5a43c782d
parente39afe1fbd6d9f1ad1eea0052a5163572e11a98f (diff)
downloadbusybox-b84dafb5e57462c91df48456dfc5bb7c811e7a24.tar.gz
busybox-b84dafb5e57462c91df48456dfc5bb7c811e7a24.tar.bz2
sed: slightly better fix for prev commit's problem
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/sed.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/editors/sed.c b/editors/sed.c
index 429c1ed..3ee8edc 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -741,9 +741,9 @@ static int do_subst_command(sed_cmd_t *sed_cmd, char **line_p)
* The match_count check is so not to break
* echo "hi" | busybox sed 's/^/!/g'
*/
- if (!G.regmatch[0].rm_so && !G.regmatch[0].rm_eo && match_count && *line) {
+ if (!G.regmatch[0].rm_so && !G.regmatch[0].rm_eo && match_count) {
pipe_putc(*line++);
- continue;
+ goto next;
}
match_count++;
@@ -755,7 +755,7 @@ static int do_subst_command(sed_cmd_t *sed_cmd, char **line_p)
) {
for (i = 0; i < G.regmatch[0].rm_eo; i++)
pipe_putc(*line++);
- continue;
+ goto next;
}
/* print everything before the match */
@@ -773,7 +773,7 @@ static int do_subst_command(sed_cmd_t *sed_cmd, char **line_p)
/* if we're not doing this globally, get out now */
if (sed_cmd->which_match != 0)
break;
-
+ next:
if (*line == '\0')
break;