This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/11039] getopt mishandles optstring of "+:"
- 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 22:17:26 -0000
- Subject: [Bug libc/11039] getopt mishandles optstring of "+:"
- References: <20091201162750.11039.ebb9@byu.net>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- Additional Comments From ebb9 at byu dot net 2009-12-02 22:17 -------
Another related problem, which is also fixed by the previously posted patch:
$ cat foo.c
#include <unistd.h>
#include <stdio.h>
int
main (int argc, char **argv)
{
int i, c;
for (i = 0; i <= 1; i++)
{
optind = i;
c = getopt (argc, argv, "+a");
if (c == -1)
printf ("got -1, optind %d\n", optind);
else
printf ("got %c, optind %d\n", c, optind);
}
return 0;
}
$ ./foo -+
foo: invalid option -- '+'
got ?, optind 2
got +, optind 2
Expected behavior is for the error message to occur twice on stderr, with both
passes returning '?'.
--
http://sourceware.org/bugzilla/show_bug.cgi?id=11039
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.