Hi Bruno,

Bruno Haible via Gnulib discussion list <bug-gnulib@gnu.org> writes:

> The problem is that the properties of an option have to be specified
> in *two* places: in the long_options array *and* in the 3rd argument
> to getopt_long().
>
> I propose to add to getopt_long() — in Gnulib — code that verifies
> the consistency between the two places, when a certain environment
> variable (say, GETOPT_DEBUG) is set. And produces output on stderr
> such as:
>   getopt_long: warning: option '--context' requires an argument but option 
> '-c' takes no argument.

I wonder that the historical rational was for having the third
parameter, the short options, in 'getopt_long'. It feels like this
information should just be derived from the long option array. That
would mean you can't give conflicting option definitions like in your
example.

I guess it is far too late to change that now though...

Collin

Reply via email to