Subject: Re: bin/20259: sort(1) numeric sort incorrect with -kn
To: None <gnats-bugs@gnats.netbsd.org (NetBSD GNATS submissions and\>
From: Giles Lean <giles@nemeton.com.au>
List: netbsd-bugs
Date: 02/10/2003 11:25:01
Greg Woods wrote:
> The problem is no doubt rooted in getopt(2) being a lot too lax.
No.
> and that should have caused the setfield() function to fail due to an
> invalid field-spec.
setfield() calls setcolumn() which in turn calls optval() in a loop
to handle the field modifiers, per the following code in init.c:
if (optval(*pos, cur_fld->tcol.num))
while ((tmp = optval(*pos, cur_fld->tcol.num))) {
cur_fld->flags |= tmp;
pos++;
}
The indentation has a glitch -- that '}' should be under the 'while',
not the 'if', but the compiler won't care.
So: the current code supports the field modifiers and appears to be
parsing them correctly. Why they're not taking effect is the
question, and I'm hoping someone familiar with the BSD sort code will
take a look.
Regards,
Giles