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/11039] getopt mishandles optstring of "+:"


------- 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.


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