diff options
author | mux <mux@FreeBSD.org> | 2002-10-25 19:41:32 +0000 |
---|---|---|
committer | mux <mux@FreeBSD.org> | 2002-10-25 19:41:32 +0000 |
commit | bdcd4ebb5d13250d4ca2e13312032e45fee4c725 (patch) | |
tree | 75099c64f010b7695aed5d86c9af5ebc925592d8 /sys/kern | |
parent | edb58880e4d8d9564ad042d1b4d801464f516816 (diff) | |
download | FreeBSD-src-bdcd4ebb5d13250d4ca2e13312032e45fee4c725.zip FreeBSD-src-bdcd4ebb5d13250d4ca2e13312032e45fee4c725.tar.gz |
- Rename the DDB specific %z printf format to %y.
- Make DDB use %y instead of %z.
- Teach GCC about %y.
- Implement support for the C99 %z format modifier.
Approved by: re@
Reviewed by: peter
Tested on: i386, sparc64
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/subr_prf.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index ac4be9b..910cf13 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -478,7 +478,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; + int jflag, zflag; int dwidth; char padc; int retval = 0; @@ -506,7 +506,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; + jflag = 0; zflag = 0; reswitch: switch (ch = (u_char)*fmt++) { case '.': dot = 1; @@ -614,6 +614,8 @@ reswitch: switch (ch = (u_char)*fmt++) { *(va_arg(ap, quad_t *)) = retval; else if (lflag) *(va_arg(ap, long *)) = retval; + else if (zflag) + *(va_arg(ap, size_t *)) = retval; else *(va_arg(ap, int *)) = retval; break; @@ -662,10 +664,13 @@ reswitch: switch (ch = (u_char)*fmt++) { case 'X': base = 16; goto handle_nosign; - case 'z': + case 'y': base = 16; sign = 1; goto handle_sign; + case 'z': + zflag = 1; + goto reswitch; handle_nosign: sign = 0; if (jflag) @@ -674,6 +679,8 @@ handle_nosign: num = va_arg(ap, u_quad_t); else if (lflag) num = va_arg(ap, u_long); + else if (zflag) + num = va_arg(ap, size_t); else num = va_arg(ap, u_int); goto number; @@ -684,6 +691,8 @@ handle_sign: num = va_arg(ap, quad_t); else if (lflag) num = va_arg(ap, long); + else if (zflag) + num = va_arg(ap, size_t); else num = va_arg(ap, int); number: |