git: a2d78713171c - main - sed: The change ("c") command should start a new cycle.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 17 Dec 2024 22:34:26 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a2d78713171cf138b5ae50d61f82df1af7574c95 commit a2d78713171cf138b5ae50d61f82df1af7574c95 Author: Valeriy Ushakov <uwe@netbsd.org> AuthorDate: 2024-12-17 22:27:01 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2024-12-17 22:34:06 +0000 sed: The change ("c") command should start a new cycle. The "c" command should start the next cycle as clarified in POSIX 2024. This is also consistent with historical and gnu sed behavior. This patch is from OpenBSD by way of NetBSD with a tweak to the man page date by me. Confirmed the test case in the bug now works. PR: 271817 Obtained from: NetBSD (1.39 uwe), OpenBSD (1.39 millert) Sponsored by: Netflix --- usr.bin/sed/process.c | 2 +- usr.bin/sed/sed.1 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c index ddf9a976bc46..d06dc09542e1 100644 --- a/usr.bin/sed/process.c +++ b/usr.bin/sed/process.c @@ -134,7 +134,7 @@ redirect: psl = 0; if (cp->a2 == NULL || lastaddr || lastline()) (void)fprintf(outfile, "%s", cp->t); - break; + goto new; case 'd': pd = 1; goto new; diff --git a/usr.bin/sed/sed.1 b/usr.bin/sed/sed.1 index 02bfbf0e9f31..345f673310d8 100644 --- a/usr.bin/sed/sed.1 +++ b/usr.bin/sed/sed.1 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 8, 2021 +.Dd December 17, 2024 .Dt SED 1 .Os .Sh NAME @@ -372,7 +372,7 @@ If the label is not specified, branch to the end of the script. .Pp .It [2addr]c\e .It text -Delete the pattern space. +Delete the pattern space and start the next cycle. With 0 or 1 address or at the end of a 2-address range, .Em text is written to the standard output.