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

From: Pádraig Brady <[email-masked]>
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.