History log of /freebsd-10.0-release/include/printf.h
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 259065 07-Dec-2013 gjb

- Copy stable/10 (r259064) to releng/10.0 as part of the
10.0-RELEASE cycle.
- Update __FreeBSD_version [1]
- Set branch name to -RC1

[1] 10.0-CURRENT __FreeBSD_version value ended at '55', so
start releng/10.0 at '100' so the branch is started with
a value ending in zero.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 238111 04-Jul-2012 pjd

The register_printf_render_std() function expects regular string.
Change argument type from 'const unsigned char *' to 'const char *'.

MFC after: 2 weeks


# 219343 06-Mar-2011 pjd

Include stdio.h, so we can include printf.h in any order, as it needs FILE.

MFC after: 2 weeks


# 156208 02-Mar-2006 phk

Add nested include of <wchar.h>


# 155300 04-Feb-2006 phk

Remove spurious "union arg" from printf.h

Make sure to always print something in the alternate time format.


# 154815 25-Jan-2006 phk

Make the %V{is} extension handle a NULL pointer like %s does: output "(null)"

Add %M{essage} extension which prints an errno value as the
corresponding string if possible or numerically otherwise.

It is not currently possible to do the syslog(3) like %m extension
because errno would need to get capatured on entry to the first
function in the printf family, so %M requires you to supply errno
as an argument.

Add %Q{uote} extension which will print a string in double quotes with
appropriate back-slash escapes (only) if necessary.


# 153486 16-Dec-2005 phk

Add an extensible version of our *printf(3) implementation to libc
on probationary terms: it may go away again if it transpires it is
a bad idea.

This extensible printf version will only be used if either
environment variable USE_XPRINTF is defined
or
one of the extension functions are called.
or
the global variable __use_xprintf is set greater than zero.

In all other cases our traditional printf implementation will
be used.

The extensible version is slower than the default printf, mostly
because less opportunity for combining I/O operation exists when
faced with extensions. The default printf on the other hand
is a bad case of spaghetti code.

The extension API has a GLIBC compatible part and a FreeBSD version
of same. The FreeBSD version exists because the GLIBC version may
run afoul of our FILE * locking in multithreaded programs and it
even further eliminate the opportunities for combining I/O operations.

Include three demo extensions which can be enabled if desired: time
(%T), hexdump (%H) and strvis (%V).

%T can format time_t (%T), struct timeval (%lT) and struct timespec (%llT)
in one of two human readable duration formats:
"%.3llT" -> "20349.245"
"%#.3llT" -> "5h39m9.245"

%H will hexdump a sequence of bytes and takes a pointer and a length
argument. The width specifies number of bytes per line.
"%4H" -> "65 72 20 65"
"%+4H" -> "0000 65 72 20 65"
"%#4H" -> "65 72 20 65 |er e|"
"%+#4H" -> "0000 65 72 20 65 |er e|"

%V will dump a string in strvis format.
"%V" -> "Hello\tWor\377ld" (C-style)
"%0V" -> "Hello\011Wor\377ld" (octal)
"%+V" -> "Hello%09Wor%FFld" (http-style)

Tests, comments, bugreports etc are most welcome.