From 2bb95458bd852e0e47cb7406857642b69e5da444 Mon Sep 17 00:00:00 2001 From: Maxime Henrion Date: Wed, 13 Nov 2002 15:15:59 +0000 Subject: [PATCH] Add support for the C99 %t format modifier. --- sys/kern/subr_prf.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 910cf13443b2..b7a818b1985f 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -478,7 +479,7 @@ kvprintf(char const *fmt, void (*func)(int, void*), void *arg, int radix, va_lis int ch, n; uintmax_t num; int base, lflag, qflag, tmp, width, ladjust, sharpflag, neg, sign, dot; - int jflag, zflag; + int jflag, tflag, zflag; int dwidth; char padc; int retval = 0; @@ -506,7 +507,7 @@ kvprintf(char const *fmt, void (*func)(int, void*), void *arg, int radix, va_lis percent = fmt - 1; qflag = 0; lflag = 0; ladjust = 0; sharpflag = 0; neg = 0; sign = 0; dot = 0; dwidth = 0; - jflag = 0; zflag = 0; + jflag = 0; tflag = 0; zflag = 0; reswitch: switch (ch = (u_char)*fmt++) { case '.': dot = 1; @@ -657,6 +658,10 @@ reswitch: switch (ch = (u_char)*fmt++) { while (width--) PCHAR(padc); break; + case 't': + tflag = 1; + goto reswitch; + break; case 'u': base = 10; goto handle_nosign; @@ -677,6 +682,8 @@ reswitch: switch (ch = (u_char)*fmt++) { num = va_arg(ap, uintmax_t); else if (qflag) num = va_arg(ap, u_quad_t); + else if (tflag) + num = va_arg(ap, ptrdiff_t); else if (lflag) num = va_arg(ap, u_long); else if (zflag) @@ -689,6 +696,8 @@ reswitch: switch (ch = (u_char)*fmt++) { num = va_arg(ap, intmax_t); else if (qflag) num = va_arg(ap, quad_t); + else if (tflag) + num = va_arg(ap, ptrdiff_t); else if (lflag) num = va_arg(ap, long); else if (zflag)