public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ebb9 at byu dot net" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sources.redhat.com
Subject: [Bug libc/11039] getopt mishandles optstring of "+:"
Date: Wed, 02 Dec 2009 22:17:00 -0000	[thread overview]
Message-ID: <20091202221726.30043.qmail@sourceware.org> (raw)
In-Reply-To: <20091201162750.11039.ebb9@byu.net>


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


  parent reply	other threads:[~2009-12-02 22:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-01 16:28 [Bug libc/11039] New: " ebb9 at byu dot net
2009-12-01 16:32 ` [Bug libc/11039] " ebb9 at byu dot net
2009-12-02 22:17 ` ebb9 at byu dot net [this message]
2010-04-08  0:57 ` drepper at redhat dot com
     [not found] <bug-11039-131@http.sourceware.org/bugzilla/>
2014-06-30 20:36 ` fweimer at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091202221726.30043.qmail@sourceware.org \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).