This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/11041] getopt -W doesn't work with optional arguments
- From: "ebb9 at byu dot net" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 2 Dec 2009 17:52:29 -0000
- Subject: [Bug libc/11041] getopt -W doesn't work with optional arguments
- References: <20091202011551.11041.ebb9@byu.net>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- 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.