summaryrefslogtreecommitdiff
path: root/sed.c
diff options
context:
space:
mode:
authorMark Whitley2000-08-10 00:09:47 +0000
committerMark Whitley2000-08-10 00:09:47 +0000
commit40406e6bad9abcd58977ed92194c9061d85c9e47 (patch)
tree305a296c9ea3827ed2a9a42e21c9dc67d4abae2e /sed.c
parentadbf018dc469d808fc0ca77f91bf37a871219d97 (diff)
downloadbusybox-40406e6bad9abcd58977ed92194c9061d85c9e47.zip
busybox-40406e6bad9abcd58977ed92194c9061d85c9e47.tar.gz
Applied patch from Mark Ferrell <mferrell@mvista.com> to fix sed '1,$p' where
sed was only printing the first line and then exiting.
Diffstat (limited to 'sed.c')
-rw-r--r--sed.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sed.c b/sed.c
index 6654719..60b1e8d 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);
}