From: Glenn L McGrath Date: Mon, 15 Sep 2003 06:28:45 +0000 (-0000) Subject: Add a test for the 'P' command and fix current implementation so it X-Git-Tag: 1_00_pre4~179 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=2eed0e2d470d7020e8bdec2a0f398a296192816b;p=oweals%2Fbusybox.git Add a test for the 'P' command and fix current implementation so it doesnt permanently modify the pattern space. --- diff --git a/editors/sed.c b/editors/sed.c index 8c77a0ffc..2b01ec7ff 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -857,7 +857,11 @@ static void process_file(FILE * file) if (tmp) { *tmp = '\0'; + puts(pattern_space); + *tmp = '\n'; + break; } + /* Fall Through */ } case 'p': /* Write the current pattern space to output */ puts(pattern_space); diff --git a/testsuite/sed/sed-write-to-stdout b/testsuite/sed/sed-write-to-stdout new file mode 100644 index 000000000..95b4d724b --- /dev/null +++ b/testsuite/sed/sed-write-to-stdout @@ -0,0 +1,10 @@ +busybox sed -n 'N;P;p'>output <