Date: Thu, 10 Oct 2002 09:30:21 -0400 (EDT) From: John Baldwin <jhb@FreeBSD.org> To: "David O'Brien" <obrien@FreeBSD.org> Cc: Andrew Gallatin <gallatin@cs.duke.edu>, freebsd-arch@FreeBSD.org, Mike Barcroft <mike@FreeBSD.org> Subject: Re: lp64 vs lp32 printf Message-ID: <XFMail.20021010093021.jhb@FreeBSD.org> In-Reply-To: <20021009220522.GA65943@dragon.nuxi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 09-Oct-2002 David O'Brien wrote: > > How is this patch? Perhaps "%y" instead of %H? It's closer to %x and was somewhat agreed upon earlier. > Index: contrib/gcc/c-format.c > =================================================================== > RCS file: /home/ncvs/src/contrib/gcc/c-format.c,v > retrieving revision 1.5 > diff -u -r1.5 c-format.c > --- contrib/gcc/c-format.c 12 Jul 2002 00:49:52 -0000 1.5 > +++ contrib/gcc/c-format.c 9 Oct 2002 21:52:40 -0000 > @@ -795,10 +795,12 @@ > The format %D provides a hexdump given a pointer and separator string: > ("%6D", ptr, ":") -> XX:XX:XX:XX:XX:XX > ("%*D", len, ptr, " ") -> XX XX XX XX ... > + The format %H is a version of %x that allows for a sign > + (e.g. -0x10 instead of 0xfffffff0, or +0x10). > */ > { "D", 1, STD_EXT, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, > BADLEN }, "-wp", "cR" }, > { "b", 1, STD_EXT, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, > BADLEN }, "-wp", "" }, > - { "rz", 0, STD_EXT, { T89_I, BADLEN, BADLEN, T89_L, BADLEN, BADLEN, BADLEN, BADLEN, > BADLEN }, "-wp0 +#", "i" }, > + { "rH", 0, STD_EXT, { T89_I, BADLEN, BADLEN, T89_L, BADLEN, BADLEN, BADLEN, BADLEN, > BADLEN }, "-wp0 +#", "i" }, > { NULL, 0, 0, NOLENGTHS, NULL, NULL } > }; > > Index: share/man/man9/printf.9 > =================================================================== > RCS file: /home/ncvs/src/share/man/man9/printf.9,v > retrieving revision 1.3 > diff -u -r1.3 printf.9 > --- share/man/man9/printf.9 1 Oct 2001 16:09:25 -0000 1.3 > +++ share/man/man9/printf.9 9 Oct 2002 21:55:51 -0000 > @@ -66,7 +66,7 @@ > .Xr printf 3 . > However, > .Xr printf 9 > -adds two other conversion specifiers. > +adds four conversion specifiers. > .Pp > The > .Cm \&%b > @@ -90,6 +90,10 @@ > for the last bit identifier. > .Pp > The > +.Cm \&%r > +identifier is undocumented. > +.Pp > +The > .Cm \&%D > identifier is meant to assist in hexdumps. > It requires two arguments: a > @@ -102,6 +106,12 @@ > The string is used as a delimiter between individual bytes. > If present, a width directive will specify the number of bytes to display. > By default, 16 bytes of data are output. > +.Pp > +The > +.Cm \&%H > +identifier is a version of > +.Cm \&%x > +that allows for a sign (e.g. -0x10 instead of 0xfffffff0, or +0x10). > .Sh RETURN VALUES > The > .Fn printf > Index: sys/ddb/db_examine.c > =================================================================== > RCS file: /home/ncvs/src/sys/ddb/db_examine.c,v > retrieving revision 1.29 > diff -u -r1.29 db_examine.c > --- sys/ddb/db_examine.c 25 Jun 2002 15:59:24 -0000 1.29 > +++ sys/ddb/db_examine.c 9 Oct 2002 21:49:55 -0000 > @@ -129,7 +129,7 @@ > case 'z': /* signed hex */ > value = db_get_value(addr, size, TRUE); > addr += size; > - db_printf("%-*lz", width, (long)value); > + db_printf("%-*lH", width, (long)value); > break; > case 'd': /* signed decimal */ > value = db_get_value(addr, size, TRUE); > @@ -212,8 +212,8 @@ > case 'x': > db_printf("%8lx", (unsigned long)addr); > break; > - case 'z': > - db_printf("%8lz", (long)addr); > + case 'H': > + db_printf("%8lH", (long)addr); > break; > case 'd': > db_printf("%11ld", (long)addr); > Index: sys/kern/subr_prf.c > =================================================================== > RCS file: /home/ncvs/src/sys/kern/subr_prf.c,v > retrieving revision 1.88 > diff -u -r1.88 subr_prf.c > --- sys/kern/subr_prf.c 28 Sep 2002 21:34:31 -0000 1.88 > +++ sys/kern/subr_prf.c 9 Oct 2002 21:49:08 -0000 > @@ -662,7 +662,7 @@ > case 'X': > base = 16; > goto handle_nosign; > - case 'z': > + case 'H': > base = 16; > if (sign) > goto handle_sign; -- John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20021010093021.jhb>