Subject: bug#16468: join

From: Pádraig Brady <[email-masked]>
Date: Fri, 02 May 2014 01:58:50 +0100

On 05/01/2014 11:26 PM, Bernhard Voelker wrote:
> On 05/01/2014 01:53 AM, Pádraig Brady wrote:
>> I added it in the attached.
> 
> Thanks, great stuff.
> 
>> diff --git a/NEWS b/NEWS
>> index 7855a48..904aace 100644
>> --- a/NEWS
>> +++ b/NEWS
>> @@ -66,6 +66,9 @@ GNU coreutils NEWS                                    -*- outline -*-
>>    causing name look-up errors.  Also look-ups are first done outside the chroot,
>>    in case the look-up within the chroot fails due to library conflicts etc.
>>  
>> +  numfmt supports zero padding of numbers using the standard --printf
>> +  syntax of a leading zero, for example --format="%010f".
>> +
> 
> s/--printf/printf/

done

>> diff --git a/src/numfmt.c b/src/numfmt.c
>> index 63411f3..c744875 100644
>> --- a/src/numfmt.c
>> +++ b/src/numfmt.c
> ...
>> @@ -992,6 +1023,9 @@ parse_format_string (char const *fmt)
>>  
>>    if (endptr != (fmt + i) && pad != 0)
>>      {
>> +      if (debug && padding_width && !(zero_padding && pad > 0))
>> +        error (0, 0, _("--format padding overridding --padding"));
>> +
> 
> In --debug mode, it seems odd that the format with the new
> zero-padding does not lead to a warning ...
> 
>   $ src/numfmt --debug --format="%09f" --padding=2 1234
>   000001234

In this case the number of leading zeros and --padding are separate.
Since they're zero padded you can freely move around the numbers in a field like:
  numfmt --header --field=2 --format="%010f" --padding=-15 < /proc/interrupts

> while a format without does:
> 
>   $ src/numfmt --debug --format="%9f" --padding=2 1234
>   src/numfmt: --format padding overridding --padding
>        1234

Here the --padding is overridden hence the warning.

thanks for the review!

I've now pushed it.

Pádraig.