This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [patch] Fix optional arguments in getopt.
- From: Peter Rosin <peda at lysator dot liu dot se>
- To: Jeff Johnston <jjohnstn at redhat dot com>
- Cc: newlib at sourceware dot org
- Date: Tue, 12 Feb 2008 20:12:09 +0100
- Subject: Re: [patch] Fix optional arguments in getopt.
- References: <200802111109.15397.andreas.micklei@ivistar.de> <20080212082147.GA8221@cobra.lysator.liu.se> <47B1D586.6070605@redhat.com>
On Tue, Feb 12, 2008 at 12:21:10PM -0500, Jeff Johnston wrote:
> Peter Rosin wrote:
> >A while back Peter Rosin wrote:
> >>I noticed that the getopt implementation does not handle optional
> >>arguments very well. E.g. ./foo --listen, where listen is an optional
> >>long argument, is interpreted to have an isten argument. Also, it is
> >>broken if other short options precede an optional short option. I.e.
> >>when -l is optional, ./foo -l works, but ./foo -il does not.
*snip*
> >Ping? The patch is simple enough, always reset optwhere to 1 after handling
> >an option with an optional argument.
> >
>
> Sorry, fell through the cracks. Patch applied.
Nice, thank you!
Cheers,
Peter