summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/xprintf.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2006-01-25 12:45:24 +0000
committerphk <phk@FreeBSD.org>2006-01-25 12:45:24 +0000
commita6d0508dd8c4beb88be6d5ca4b35e12db40e8312 (patch)
tree8b1b9e153704a2e4059c4a81c88f8bdaa0817a60 /lib/libc/stdio/xprintf.c
parentb52efc57bec49fd584f1580087664aff15a10168 (diff)
downloadFreeBSD-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.c')
-rw-r--r--lib/libc/stdio/xprintf.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/libc/stdio/xprintf.c b/lib/libc/stdio/xprintf.c
index 3b27782..c7814fa 100644
--- a/lib/libc/stdio/xprintf.c
+++ b/lib/libc/stdio/xprintf.c
@@ -655,6 +655,16 @@ register_printf_render_std(const unsigned char *specs)
__printf_render_hexdump,
__printf_arginfo_hexdump);
break;
+ case 'M':
+ register_printf_render(*specs,
+ __printf_render_errno,
+ __printf_arginfo_errno);
+ break;
+ case 'Q':
+ register_printf_render(*specs,
+ __printf_render_quote,
+ __printf_arginfo_quote);
+ break;
case 'T':
register_printf_render(*specs,
__printf_render_time,
OpenPOWER on IntegriCloud