diff options
author | phk <phk@FreeBSD.org> | 2006-01-25 12:45:24 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2006-01-25 12:45:24 +0000 |
commit | a6d0508dd8c4beb88be6d5ca4b35e12db40e8312 (patch) | |
tree | 8b1b9e153704a2e4059c4a81c88f8bdaa0817a60 /lib/libc/stdio/xprintf_vis.c | |
parent | b52efc57bec49fd584f1580087664aff15a10168 (diff) | |
download | FreeBSD-src-a6d0508dd8c4beb88be6d5ca4b35e12db40e8312.zip FreeBSD-src-a6d0508dd8c4beb88be6d5ca4b35e12db40e8312.tar.gz |
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.
Diffstat (limited to 'lib/libc/stdio/xprintf_vis.c')
-rw-r--r-- | lib/libc/stdio/xprintf_vis.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libc/stdio/xprintf_vis.c b/lib/libc/stdio/xprintf_vis.c index 2f8d63e..819f09f 100644 --- a/lib/libc/stdio/xprintf_vis.c +++ b/lib/libc/stdio/xprintf_vis.c @@ -54,6 +54,8 @@ __printf_render_vis(struct __printf_io *io, const struct printf_info *pi, const ret = 0; p = *((char **)arg[0]); + if (p == NULL) + return (__printf_out(io, pi, "(null)", 6)); if (pi->prec >= 0) l = pi->prec; else |