From owner-freebsd-arch Thu Oct 10 6:30:30 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 081B137B404 for ; Thu, 10 Oct 2002 06:30:23 -0700 (PDT) Received: from mail.speakeasy.net (mail15.speakeasy.net [216.254.0.215]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7001943EAA for ; Thu, 10 Oct 2002 06:30:20 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 26910 invoked from network); 10 Oct 2002 13:30:19 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail15.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 10 Oct 2002 13:30:19 -0000 Received: from laptop.baldwin.cx (laptop.baldwin.cx [192.168.0.4]) by server.baldwin.cx (8.12.6/8.12.6) with ESMTP id g9ADUHn5014556; Thu, 10 Oct 2002 09:30:17 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20021009220522.GA65943@dragon.nuxi.com> Date: Thu, 10 Oct 2002 09:30:21 -0400 (EDT) From: John Baldwin To: "David O'Brien" Subject: Re: lp64 vs lp32 printf Cc: Andrew Gallatin , freebsd-arch@FreeBSD.org, Mike Barcroft Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 <>< 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