From owner-freebsd-arch Wed Oct 9 15: 5:29 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 9DE2737B406; Wed, 9 Oct 2002 15:05:24 -0700 (PDT) Received: from dragon.nuxi.com (trang.nuxi.com [66.92.13.169]) by mx1.FreeBSD.org (Postfix) with ESMTP id 17C1D43E4A; Wed, 9 Oct 2002 15:05:24 -0700 (PDT) (envelope-from obrien@NUXI.com) Received: from dragon.nuxi.com (obrien@localhost [127.0.0.1]) by dragon.nuxi.com (8.12.6/8.12.2) with ESMTP id g99M5M5b065967; Wed, 9 Oct 2002 15:05:22 -0700 (PDT) (envelope-from obrien@dragon.nuxi.com) Received: (from obrien@localhost) by dragon.nuxi.com (8.12.6/8.12.5/Submit) id g99M5Mve065966; Wed, 9 Oct 2002 15:05:22 -0700 (PDT) Date: Wed, 9 Oct 2002 15:05:22 -0700 From: "David O'Brien" To: John Baldwin Cc: Mike Barcroft , freebsd-arch@FreeBSD.org, Andrew Gallatin Subject: Re: lp64 vs lp32 printf Message-ID: <20021009220522.GA65943@dragon.nuxi.com> Reply-To: obrien@FreeBSD.org References: <20021008203120.K97120@espresso.q9media.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-Operating-System: FreeBSD 5.0-CURRENT Organization: The NUXI BSD Group X-Pgp-Rsa-Fingerprint: B7 4D 3E E9 11 39 5F A3 90 76 5D 69 58 D9 98 7A X-Pgp-Rsa-Keyid: 1024/34F9F9D5 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 How is this patch? 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; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message