coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: human-readable / block-size as a general utility?


From: Pádraig Brady
Subject: Re: human-readable / block-size as a general utility?
Date: Thu, 18 Aug 2011 15:57:39 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110707 Thunderbird/5.0

On 08/18/2011 03:09 PM, Eric Blake wrote:
> On 08/18/2011 08:00 AM, Pádraig Brady wrote:
>>
>> Perhaps a printf format spec?
>> %h is available,
> 
> No it's not.  printf %hx prints a short int, printf %hhx prints a char as an 
> int.

Oops I meant %H.
Even though a capital I discounted it as there are others used:
http://www.pixelbeat.org/programming/gcc/format_specs.html

> Meanwhile, although both the bash builtin and coreutils' printf parse these 
> two formats, they actually still end up widening to int before printing; 
> arguably a bug:
> 
> $ printf %hhx -1
> ffffffffffffffff
> $ echo 'format(%hx,-1)' | m4
> ff
> 

I'd agree that's a bug.
I also notice that neither solaris or freebsd support %h

cheers,
Pádraig.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]