summaryrefslogtreecommitdiff
path: root/editors/sed.c
diff options
context:
space:
mode:
authorGlenn L McGrath2003-09-15 06:12:53 +0000
committerGlenn L McGrath2003-09-15 06:12:53 +0000
commit6e5687abc3732fac6d8a43a324b8f284f7a5482d (patch)
treea52bb068db8a2a021bca47a8b8c4b2c486dfc863 /editors/sed.c
parent7b3512129799fe07195d188133605fde5c8c6e75 (diff)
downloadbusybox-6e5687abc3732fac6d8a43a324b8f284f7a5482d.zip
busybox-6e5687abc3732fac6d8a43a324b8f284f7a5482d.tar.gz
A test and fix for the sed 'n' command
Diffstat (limited to 'editors/sed.c')
-rw-r--r--editors/sed.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/editors/sed.c b/editors/sed.c
index 00ed208..8c77a0f 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -985,11 +985,19 @@ static void process_file(FILE * file)
next_line = NULL;
break;
case 'n': /* Read next line from input */
+ if (!be_quiet) {
+ puts(pattern_space);
+ }
if (next_line) {
free(pattern_space);
pattern_space = next_line;
next_line = bb_get_chomped_line_from_file(file);
linenum++;
+ } else {
+ /* Jump to end of script and exist */
+ deleted = 1;
+ free(next_line);
+ next_line = NULL;
}
break;
case 'N': /* Append the next line to the current line */