From owner-freebsd-standards Fri Apr 5 3:50:25 2002 Delivered-To: freebsd-standards@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id A0DAD37B404 for ; Fri, 5 Apr 2002 03:50:03 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g35Bo3955377; Fri, 5 Apr 2002 03:50:03 -0800 (PST) (envelope-from gnats) Date: Fri, 5 Apr 2002 03:50:03 -0800 (PST) Message-Id: <200204051150.g35Bo3955377@freefall.freebsd.org> To: freebsd-standards@FreeBSD.org Cc: From: "Tim J. Robbins" Subject: Re: standards/36783: P1003.1-2001 -s -A -j -N -t options for od(1) (patch) Reply-To: "Tim J. Robbins" Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG The following reply was made to PR standards/36783; it has been noted by GNATS. From: "Tim J. Robbins" To: freebsd-gnats-submit@FreeBSD.ORG Cc: Subject: Re: standards/36783: P1003.1-2001 -s -A -j -N -t options for od(1) (patch) Date: Fri, 5 Apr 2002 21:42:09 +1000 On Fri, Apr 05, 2002 at 09:13:39PM +1000, Tim J. Robbins wrote: > + n = (1ULL << (8 * size)) - 1; > + digits = 0; > + while (n != 0) { > + digits++; > + n >>= (fchar == 'o' || fchar == 'd') ? 3 : 4; > + } Oops. There is a little problem here with output of unsigned decimal numbers. --- odsyntax.c.old Fri Apr 5 21:37:47 2002 +++ odsyntax.c Fri Apr 5 21:41:07 2002 @@ -333,10 +333,11 @@ digits = 0; while (n != 0) { digits++; - n >>= (fchar == 'o' || fchar == 'd') ? 3 : 4; + n >>= (fchar == 'x') ? 4 : 3; } asprintf(&hdfmt, "%d/%d \"%%%s%d%c \" \"\\n\"", - 16 / size, size, fchar == 'd' ? "" : "0", + 16 / size, size, + (fchar == 'd' || fchar == 'u') ? "" : "0", digits, fchar); if (hdfmt == NULL) err(1, NULL); Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message