bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Human readable sort


From: Jim Meyering
Subject: Re: Human readable sort
Date: Thu, 02 Jul 2009 08:17:12 +0200

Pádraig Brady wrote:
> I was thinking that the mixed IEC/SI check
> should be applied to each key separately rather
> than globally. What do you think? Patch attached.
>
>>From ef06a30d122fc9ccac51a682a3abf6868d8832d6 Mon Sep 17 00:00:00 2001
...
> -check_mixed_SI_IEC (char prefix)
> +check_mixed_SI_IEC (char prefix, struct keyfield *key)
>  {
> -  static int seen_si = -1;
> -  bool si_present = prefix == 'i';
> -  if (seen_si != -1 && seen_si != si_present)
> +  int si_present = prefix == 'i';
> +  if (key->si_present != -1 && si_present != key->si_present)
>      error (SORT_FAILURE, 0, _("both SI and IEC prefixes present on units"));

Good idea.

Not part of this change, I know, but that diagnostic should include a
file name.  Imagine sorting many files, with many key specifiers (hence
many columns of data) and very many lines, yet only a few offenders.

With a file_name:line number (and byte/char-count?) and maybe even a
sample of the offending data, it'd be easier to spot and correct the
problem.




reply via email to

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