GNU bug report logs -
#6176
[PATCH 1/2] sort: add a --debug option to highlight key extents
Previous Next
Reported by: Pádraig Brady <P <at> draigBrady.com>
Date: Tue, 11 May 2010 22:59:02 UTC
Severity: normal
Tags: patch
Done: Jim Meyering <jim <at> meyering.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 14/05/10 22:47, Pádraig Brady wrote:
> On 14/05/10 22:23, Paul Eggert wrote:
>> Something like the following diagnostic would be far more helpful for
>> users who are not 'sort' experts:
>>
>> sort: obsolescent key `+2 -4' used; consider `-k 3,4' instead
>>
>> Can you please arrange for that?
I did that using this chunk.
Note that it doesn't reproduce char offsets or flags
on the old or new formats, but they're the same on
both formats, so it's not worth the complexity I think.
if (key->obsolete_used)
{
/* obsolescent syntax +A.x -B.y is equivalent to:
-k A+1.x+1,B.y (when y = 0)
-k A+1.x+1,B+1.y (when y > 0) */
char obuf[INT_BUFSIZE_BOUND (size_t) * 2 + 4]; /* +# -# */
char nbuf[INT_BUFSIZE_BOUND (size_t) * 2 + 5]; /* -k #,# */
char *po = obuf;
char *pn = nbuf;
size_t sword = key->sword;
size_t eword = key->eword;
if (sword == SIZE_MAX)
sword++;
po += sprintf (po, "+%" PRIuMAX, (uintmax_t) sword);
pn += sprintf (pn, "-k %" PRIuMAX, (uintmax_t) sword + 1);
if (key->eword != SIZE_MAX)
{
po += sprintf (po, " -%" PRIuMAX, (uintmax_t) eword + 1);
pn += sprintf (pn, ",%" PRIuMAX,
(uintmax_t) eword + 1 + (key->echar == SIZE_MAX));
}
error (0, 0, _("obsolescent key `%s' used; consider `%s' instead"),
obuf, nbuf);
}
That latest patch is at http://url.ie/660o
cheers,
Pádraig.
This bug report was last modified 15 years and 5 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.