Subject: Re: RFC: getopt_long(3) change
To: M Graff <explorer@flame.org>
From: Brian Ginsbach <ginsbach@NetBSD.org>
List: tech-userlevel
Date: 06/27/2007 17:13:55
On Tue, Jun 26, 2007 at 05:03:45PM -0500, M Graff wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I also found a problem when using some package (id3v2 I think) which has
> options like:
> 
> 	--list-frames
> 	--list-genres
> 	--list
> 
> The problem is, --list is treated as 'ambiguous' even though it is an
> EXACT match.  Ideally, the code should search for an exact match first,
> then resort to trying to find the only option that begins with that
> string second.  It can remember strings it finds along the way, of
> course, so the best match is always found without walking the list twice.
> 

The proposed patch fixes this problem too.

The current getopt_long(3) works only if the long option array
passed has "list" before the longer "list-frames" and "list-genres".
Again this seems to violate POLA.