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: Eric Blake
Subject: Re: human-readable / block-size as a general utility?
Date: Thu, 18 Aug 2011 08:09:12 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.11

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.

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

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



reply via email to

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