Add a test for the 'P' command and fix current implementation so it
doesnt permanently modify the pattern space.
This commit is contained in:
parent
6e5687abc3
commit
2eed0e2d47
@ -857,7 +857,11 @@ static void process_file(FILE * file)
|
|||||||
|
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
*tmp = '\0';
|
*tmp = '\0';
|
||||||
|
puts(pattern_space);
|
||||||
|
*tmp = '\n';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
/* Fall Through */
|
||||||
}
|
}
|
||||||
case 'p': /* Write the current pattern space to output */
|
case 'p': /* Write the current pattern space to output */
|
||||||
puts(pattern_space);
|
puts(pattern_space);
|
||||||
|
10
testsuite/sed/sed-write-to-stdout
Normal file
10
testsuite/sed/sed-write-to-stdout
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
busybox sed -n 'N;P;p'>output <<EOF
|
||||||
|
a
|
||||||
|
b
|
||||||
|
c
|
||||||
|
EOF
|
||||||
|
cmp -s output - <<EOF
|
||||||
|
a
|
||||||
|
a
|
||||||
|
b
|
||||||
|
EOF
|
Loading…
Reference in New Issue
Block a user