Hi Bruno,
Bruno Haible wrote:
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.
I think that it would be better to fix the problem for good by deprecating
getopt_long and recommending instead something that defines the options in
one place, as Arg_parser does. Even if this implies some minor changes in
the programs to adapt to the new (simpler) interface.
See this fragment of main.c from GNU ed showing how it defines the options
for Arg_parser:
const ap_Option options[] =
{
{ 'E', "extended-regexp", ap_no },
{ 'G', "traditional", ap_no },
{ 'h', "help", ap_no },
{ 'l', "loose-exit-status", ap_no },
{ 'p', "prompt", ap_yes },
Just my 2 (euro)cents.
Antonio.