I agree that deserves describing, just in case some system ever
implements the standard and only the standard.
Andras Farkas wrote on Mon, Jul 29, 2019 at 11:54:18PM -0400:
> I have a diff attached which fixes the man page.
I don't quite agree with your patch. In practice, both \0num
and \num work; i inspected the code of FreeBSD and NetBSD which
both appear to support \num, too, even though they don't document
it, and i tested on Linux, and on Solaris 9, 10, and 11, and both
forms work everywhere:
RCS file: /cvs/src/usr.bin/printf/printf.1,v
retrieving revision 1.32
diff -u -r1.32 printf.1
--- printf.1 2 Jun 2019 06:16:37 -0000 1.32
+++ printf.1 1 Aug 2019 21:53:11 -0000
@@ -319,6 +319,15 @@
Characters from the string
are printed with backslash-escape sequences expanded.
+.Ar argument ,
+ASCII characters can be octally encoded either as
+.Cm \e0 Ns Ar num
+.Cm \e Ns Ar num
+like in the
contains the special escape sequence
@@ -373,7 +382,17 @@
.Ev LC_ALL Ns =C
-The escape sequences \ee and \e' are extensions to that specification.
+The escape sequences
+.Cm \e' ,
+as well as omitting the leading digit
+.Cm \e0 Ns Ar num
+octal escape sequences in
+arguments, are extensions to that specification.
On Thu, Aug 1, 2019 at 5:54 PM Ingo Schwarze <[hidden email]> wrote:
> please do not cross-post on OpenBSD lists, choose whatever list fits
> best. I trimmed bugs@ for this followup.
Ah, my bad. I just found it unclear which list to send documentation
issues to. I've normally sent them to bugs@ in the past, but then I
also sent a diff and I've been told diffs usually go to tech@
I'd totally subscribe to a docs@ if there was one. :D
> I don't quite agree with your patch. In practice, both \0num
> and \num work; i inspected the code of FreeBSD and NetBSD which
> both appear to support \num, too, even though they don't document
> it, and i tested on Linux, and on Solaris 9, 10, and 11, and both
> forms work everywhere:
> $ printf '%b\n' '\0176x'
> $ printf '%b\n' '\176x'
True, that's right.
> So here is an alternative patch.
This patch looks great.