sed: fix c cmd
authorDenys Vlasenko <vda.linux@googlemail.com>
Tue, 20 Apr 2010 02:36:07 +0000 (22:36 -0400)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 20 Apr 2010 02:36:07 +0000 (22:36 -0400)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
editors/sed.c
testsuite/sed.tests

index e5e187725324b711162b29ca1b679b8ecc1fccb3..302a156051a23938e5c1425ee0bdc2c22cd964bc 100644 (file)
@@ -1031,7 +1031,7 @@ static void process_files(void)
                case 'c':
                        /* Only triggers on last line of a matching range. */
                        if (!sed_cmd->in_match)
-                               sed_puts(sed_cmd->string, NO_EOL_CHAR);
+                               sed_puts(sed_cmd->string, '\n');
                        goto discard_line;
 
                /* Read file, append contents to output */
index 875c946be80dc810cf4c25ffc625de34b8b4a456..f88524d073498d40d2debb865fc63cd071f16ff7 100755 (executable)
@@ -248,4 +248,9 @@ testing "sed beginning (^) matches only once" \
        ">/usr</>lib<\n" "" \
        "/usr/lib\n"
 
+testing "sed c" \
+       "sed 'crepl'" \
+       "repl\nrepl\n" "" \
+       "first\nsecond\n"
+
 exit $FAILCOUNT