Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 03 Jun 2019 17:36:11 +0000
From:      bugzilla-noreply@freebsd.org
To:        doc@FreeBSD.org
Subject:   [Bug 238313] printf(1) man page incorrect
Message-ID:  <bug-238313-9@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D238313

            Bug ID: 238313
           Summary: printf(1) man page incorrect
           Product: Documentation
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Manual Pages
          Assignee: bugs@FreeBSD.org
          Reporter: deepbluemistake@gmail.com
                CC: doc@FreeBSD.org

Incorrectly, the man page for printf(1) states that the \c escape works all=
 the
time.  In reality, on FreeBSD, (and according to POSIX too) the \c escape o=
nly
works for text meant for the %b format specifier, but not in the format its=
elf.

Actual behavior on FreeBSD (which is also correct POSIX behavior):
$ /usr/bin/printf 'foo\cbar\n'
foocbar
$ /usr/bin/printf '%b' 'foo\cbar\n'
foo$=20
# The above '$ ' in 'foo$ ' is from the shell, not printf.
$ uname -a
FreeBSD nyann.tanasinn.mochi 12.0-RELEASE-p4 FreeBSD 12.0-RELEASE-p4 GENERI=
C=20
amd64
$ freebsd-version
12.0-RELEASE-p5

The solution for this would be to move the info about \c to the section abo=
ut
the %b format, where its own special \0 handling is also specified.

Useful references:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html
https://www.freebsd.org/cgi/man.cgi?query=3Dprintf&apropos=3D0&sektion=3D0&=
manpath=3DFreeBSD+12.0-RELEASE+and+Ports&arch=3Ddefault&format=3Dhtml

--=20
You are receiving this mail because:
You are on the CC list for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-238313-9>