summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConrad Meyer <cem@FreeBSD.org>2016-06-01 16:11:09 +0000
committerConrad Meyer <cem@FreeBSD.org>2016-06-01 16:11:09 +0000
commita3c00561214b5760b0f54bc6f42168c891b240e5 (patch)
treeef942d0259ea2df00d35646f710286199c799151
parent3a7d122f969141c213b64afe9b0d7dd8412051b2 (diff)
Notes
-rw-r--r--lib/libthr/thread/thr_printf.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libthr/thread/thr_printf.c b/lib/libthr/thread/thr_printf.c
index 8e9a1518ba8b..d38ee1869c9e 100644
--- a/lib/libthr/thread/thr_printf.c
+++ b/lib/libthr/thread/thr_printf.c
@@ -68,15 +68,19 @@ _thread_vprintf(int fd, const char *fmt, va_list ap)
unsigned long r, u;
int c;
long d;
- int islong;
+ int islong, isalt;
while ((c = *fmt++)) {
+ isalt = 0;
islong = 0;
if (c == '%') {
next: c = *fmt++;
if (c == '\0')
return;
switch (c) {
+ case '#':
+ isalt = 1;
+ goto next;
case 'c':
pchar(fd, va_arg(ap, int));
continue;
@@ -87,10 +91,13 @@ next: c = *fmt++;
islong = 1;
goto next;
case 'p':
+ pstr(fd, "0x");
islong = 1;
case 'd':
case 'u':
case 'x':
+ if (c == 'x' && isalt)
+ pstr(fd, "0x");
r = ((c == 'u') || (c == 'd')) ? 10 : 16;
if (c == 'd') {
if (islong)