This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/11041] getopt -W doesn't work with optional arguments


------- Additional Comments From ebb9 at byu dot net  2009-12-02 17:52 -------
Another instance:

Commits b8b17701a and fc5f4a974 add special handling of getopt_long (but NOT
getopt_long_only) to recognize alternate spellings that would result in the same
behavior, and treat those as non-ambiguous.  But -W did not pick up the same
code change.

$ cat foo.c
#include <stdio.h>
#include <getopt.h>
static const struct option opts[] =
  {
    { "a1",    no_argument, NULL, 'a' },
    { "a2",    no_argument, NULL, 'a' },
    { NULL,    0,           NULL, 0 }
  };
int
main (int argc, char **argv)
{
  int c = getopt_long (argc, argv, ":W;", opts, NULL);
  if (c == -1)
    puts ("got -1");
  else
    printf ("got %c\n", c);
  return 0;
}
$ ./foo --a
got a
$ ./foo -W a
got ?


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=11041

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]