GNU bug report logs - #24015
[PATCH] sort: make -h work with -k and blank used as thousands separator

Previous Next

Package: coreutils;

Reported by: Kamil Dudka <kdudka <at> redhat.com>

Date: Sun, 17 Jul 2016 16:03:01 UTC

Severity: normal

Tags: patch

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 24015 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Kamil Dudka <kdudka <at> redhat.com>, 24015 <at> debbugs.gnu.org
Subject: Re: bug#24015: [PATCH] sort: make -h work with -k and blank used as
 thousands separator
Date: Sun, 17 Jul 2016 21:05:13 +0100
> On 17/07/16 17:02, Kamil Dudka wrote:
>> diff --git a/src/sort.c b/src/sort.c
>> index f717604..a2cadda 100644
>> --- a/src/sort.c
>> +++ b/src/sort.c
>> @@ -1904,12 +1904,16 @@ find_unit_order (char const *number)
>>       to be lacking in units.
>>       FIXME: add support for multibyte thousands_sep and decimal_point.  */
>>  
>> -  do
>> +  while (ISDIGIT (ch = *p++))
>>      {
>> -      while (ISDIGIT (ch = *p++))
>> -        nonzero |= ch - '0';
>> +      nonzero |= ch - '0';
>> +
>> +      /* Allow to skip only one occurrence of thousands_sep to avoid finding
>> +         the unit in the next column in case thousands_sep matches as blank
>> +         and is used as column delimiter.  */
>> +      if (*p == thousands_sep)
>> +        ++p;
>>      }
>> -  while (ch == thousands_sep);
> 

There is also similar logic in debug_key that would need the same adjustments.

cheers,
Pádraig.





This bug report was last modified 9 years and 1 day ago.

Previous Next


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