bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#65659: [PATCH] printf: add %#s alias to %b


From: Pádraig Brady
Subject: bug#65659: [PATCH] printf: add %#s alias to %b
Date: Thu, 31 Aug 2023 21:48:09 +0100
User-agent: Mozilla Thunderbird

On 31/08/2023 19:31, Eric Blake wrote:
POSIX Issue 8 will be obsoleting %b (escape sequence interpolation) so
that future Issue 9 can change to having %b (binary literal output)
that aligns with C2x.  But since escape interpolation may still remain
useful, POSIX suggested %#s (which is undefined in all versions of C)
as a possible alias for the older %b behavior.

* src/printf.c (print_formatted, usage): Support %#s as an alias
for %b, in order to open doors to future repurposing of %b to
binary output while still allowing access to its old behavior.
* doc/coreutils.texi (printf invocation): Document it.
* NEWS: Likewise.
* tests/printf/printf-quote.sh: Add unit test coverage.

Patch looks good thanks.
I'd add in the attached test addition.

As for compat, I notice that existing coreutils will reject %#s,
while bash 5.2.15, ksh 1.0.4, dash 0.5.12 will treat as %s.

cheers,
Pádraig

Attachment: printf-esc-test.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]