GNU bug report logs - #7176
Feature request: add option to display full units in -h and --si output

Previous Next

Package: coreutils;

Reported by: Mihai Capotă <mihai <at> mihaic.ro>

Date: Fri, 8 Oct 2010 16:58:02 UTC

Severity: normal

Tags: patch, wontfix

Merged with 14113

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Pádraig Brady <P <at> draigBrady.com>
To: Mihai Capotă <mihai <at> mihaic.ro>
Cc: 7176 <at> debbugs.gnu.org
Subject: bug#7176: [PATCH] human: add unambiguous block_size_args
Date: Sun, 14 Apr 2013 00:52:03 +0100
forcemerge 14113 7176
stop

On 04/01/2013 01:38 PM, Mihai Capotă wrote:
> The units used in the outputs of "human-readable" and "si" look
> identical when "K/k" is not present. Add two block_size_args, "binary"
> and "decimal", that disambiguate between the outputs of "human-readable"
> and "si" by adding human_B to the list of options.
> 
> See bug 7176 in GNU coreutils,
> <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7176>.
> ---
>  lib/human.c |   14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/human.c b/lib/human.c
> index 613dc65..66a1835 100644
> --- a/lib/human.c
> +++ b/lib/human.c
> @@ -394,11 +394,21 @@ human_readable (uintmax_t n, char *buf, int opts,
>  # define DEFAULT_BLOCK_SIZE 1024
>  #endif
>  
> -static char const *const block_size_args[] = { "human-readable", "si", 0 };
> +static char const *const block_size_args[] =
> +  {
> +    "human-readable",
> +    "si",
> +    "binary",
> +    "decimal",
> +    0
> +  };
> +
>  static int const block_size_opts[] =
>    {
>      human_autoscale + human_SI + human_base_1024,
> -    human_autoscale + human_SI
> +    human_autoscale + human_SI,
> +    human_autoscale + human_SI + human_base_1024 + human_B,
> +    human_autoscale + human_SI + human_B
>    };

So I was 50:50 on making this change, and in the meantime numfmt(1) was released,
which gives full control over number formatting, albeit in a more verbose/explicit form.

thanks,
Pádraig





This bug report was last modified 6 years and 284 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.