[patch] Fix optional arguments in getopt.

Peter Rosin peda@lysator.liu.se
Tue Feb 12 20:48:00 GMT 2008

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.


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


More information about the Newlib mailing list