diff options
author | Bruce Evans <bde@FreeBSD.org> | 1998-07-08 10:41:32 +0000 |
---|---|---|
committer | Bruce Evans <bde@FreeBSD.org> | 1998-07-08 10:41:32 +0000 |
commit | e0c38587af87a66ef1693b5e4c95d386079a909f (patch) | |
tree | 1e16c05441f6a85592f3bb2bbba9bccf5a1e296c /sys/kern/subr_prf.c | |
parent | 3da6ef3c3a473badd556f6c2ff12ae2c16f97803 (diff) | |
download | src-test2-e0c38587af87a66ef1693b5e4c95d386079a909f.tar.gz src-test2-e0c38587af87a66ef1693b5e4c95d386079a909f.zip |
Notes
Diffstat (limited to 'sys/kern/subr_prf.c')
-rw-r--r-- | sys/kern/subr_prf.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index c30e45bedb90..9474a667d520 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)subr_prf.c 8.3 (Berkeley) 1/21/94 - * $Id: subr_prf.c,v 1.45 1998/05/19 08:58:51 phk Exp $ + * $Id: subr_prf.c,v 1.46 1998/05/28 09:30:20 phk Exp $ */ #include <sys/param.h> @@ -490,18 +490,20 @@ reswitch: switch (ch = (u_char)*fmt++) { case 'l': lflag = 1; goto reswitch; - case 'n': - ul = lflag ? va_arg(ap, u_long) : va_arg(ap, u_int); - base = radix; - goto number; case 'o': ul = lflag ? va_arg(ap, u_long) : va_arg(ap, u_int); base = 8; - goto number; + goto nosign; case 'p': ul = (u_long)va_arg(ap, void *); base = 16; sharpflag = 1; + goto nosign; + case 'n': + case 'r': + ul = lflag ? va_arg(ap, u_long) : + sign ? (u_long)va_arg(ap, int) : va_arg(ap, u_int); + base = radix; goto number; case 's': p = va_arg(ap, char *); @@ -527,10 +529,17 @@ reswitch: switch (ch = (u_char)*fmt++) { case 'u': ul = lflag ? va_arg(ap, u_long) : va_arg(ap, u_int); base = 10; - goto number; + goto nosign; case 'x': ul = lflag ? va_arg(ap, u_long) : va_arg(ap, u_int); base = 16; + goto nosign; + case 'z': + ul = lflag ? va_arg(ap, u_long) : + sign ? (u_long)va_arg(ap, int) : va_arg(ap, u_int); + base = 16; + goto number; +nosign: sign = 0; number: if (sign && (long)ul < 0L) { neg = 1; ul = -(long)ul; |