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