Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Apr 2002 03:50:03 -0800 (PST)
From:      "Tim J. Robbins" <tim@robbins.dropbear.id.au>
To:        freebsd-standards@FreeBSD.org
Subject:   Re: standards/36783: P1003.1-2001 -s -A -j -N -t options for od(1) (patch)
Message-ID:  <200204051150.g35Bo3955377@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR standards/36783; it has been noted by GNATS.

From: "Tim J. Robbins" <tim@robbins.dropbear.id.au>
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204051150.g35Bo3955377>