[Bug 284434] ed(1) special replacement with "%" doesn't quite match with man-page

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 01 Feb 2025 18:33:41 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284434

Martin Neitzel <neitzel@marshlabs.gaertner.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |neitzel@marshlabs.gaertner.
                   |                            |de

--- Comment #3 from Martin Neitzel <neitzel@marshlabs.gaertner.de> ---
Created attachment 257169
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=257169&action=edit
Corrected, tested, working patch for ed "%" recognition.

This is a tested, working patch based on Tim's prior suggestions.
It uses the proper line end and keeps the lines <80 cols.

I couldn't really decide regarding the "c=" optimization -- it makes the code
more difficult to read and I'd expect a compiler's CSE to optimize this anyway.

A side-note on the side-note: the behaviour that a "s/old/new/" including the
trailing delimiter is silent but an omitted trailing delimiter ("s/old/new")
effects the resulting line to be printed (as with "/p") is intended,
documented, and even POSIXly mandated.

FWIW:  as of now, the current OpenBSD, NetBSD and DragonflyBSD brethren suffer
from the same bug.

-- 
You are receiving this mail because:
You are the assignee for the bug.