From: Mark Whitley Date: Thu, 10 Aug 2000 00:09:47 +0000 (-0000) Subject: Applied patch from Mark Ferrell to fix sed '1,$p' where X-Git-Tag: 0_47~169 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=40406e6bad9abcd58977ed92194c9061d85c9e47;p=oweals%2Fbusybox.git Applied patch from Mark Ferrell to fix sed '1,$p' where sed was only printing the first line and then exiting. --- diff --git a/editors/sed.c b/editors/sed.c index 665471913..60b1e8d2e 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -639,8 +639,8 @@ static void process_file(FILE *file) } /* are we acting on a range of line numbers? */ - else if (sed_cmds[i].beg_line > 0 && sed_cmds[i].end_line > 0) { - if (linenum >= sed_cmds[i].beg_line && linenum <= sed_cmds[i].end_line) + else if (sed_cmds[i].beg_line > 0 && sed_cmds[i].end_line != 0) { + if (linenum >= sed_cmds[i].beg_line && (sed_cmds[i].end_line == -1 || linenum <= sed_cmds[i].end_line)) line_altered += do_sed_command(&sed_cmds[i], line); } diff --git a/sed.c b/sed.c index 665471913..60b1e8d2e 100644 --- a/sed.c +++ b/sed.c @@ -639,8 +639,8 @@ static void process_file(FILE *file) } /* are we acting on a range of line numbers? */ - else if (sed_cmds[i].beg_line > 0 && sed_cmds[i].end_line > 0) { - if (linenum >= sed_cmds[i].beg_line && linenum <= sed_cmds[i].end_line) + else if (sed_cmds[i].beg_line > 0 && sed_cmds[i].end_line != 0) { + if (linenum >= sed_cmds[i].beg_line && (sed_cmds[i].end_line == -1 || linenum <= sed_cmds[i].end_line)) line_altered += do_sed_command(&sed_cmds[i], line); }