From 5a2f7828463ea3dcf996e87f58cd613a4eca71ef Mon Sep 17 00:00:00 2001 From: corinna Date: Wed, 7 Nov 2001 11:47:22 +0000 Subject: [PATCH] * lib/getopt.c (getopt_internal): Reset optind to 1 only if optreset is not set. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/lib/getopt.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index f6f9788aa4..78e345ec50 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2001-11-07 Corinna Vinschen + + * lib/getopt.c (getopt_internal): Reset optind to 1 only if optreset + is not set. + 2001-11-06 Christopher Faylor * select.cc (fhandler_tty_slave::ready_for_read): Correct inverted diff --git a/winsup/cygwin/lib/getopt.c b/winsup/cygwin/lib/getopt.c index c6f967d8ee..effa5d7746 100644 --- a/winsup/cygwin/lib/getopt.c +++ b/winsup/cygwin/lib/getopt.c @@ -214,7 +214,7 @@ getopt_internal(int nargc, char *const * nargv, const char *options) * XXX re-initialize optind to 0 and have getopt_long(3) * XXX properly function again. Work around this braindamage. */ - if (optind == 0) + if (optind == 0 && optreset == 0) optind = 1; if (optreset) -- 2.11.0