Ben Pfaff <b...@cs.stanford.edu> writes: >> 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. > > Another approach would be to provide a function that dynamically > generates the shortopts > argument to pass getopt_long(), given the long options. Then there > would be less work and > less to keep consistent for developers.
That was the same thought I had too. We could do it in Gnulib, since I am not sure how open glibc will be to the idea. I really like when programs support long options, especially for extensions they have beyond POSIX, for example. It would be a shame if Bruno decided to not use getopt_long, because he does not want to deal with this inconsistency arising. I guess he could support them by manually parsing ARGV, but that is no fun. And an easy way to write nasty bugs. :) Collin