changeset 869:ca8a87089389

(parse_long_options): Reset optind to zero before just returning so that getopt internals get initialized from the probably-new parameters when/if getopt is called later.
author Jim Meyering <jim@meyering.net>
date Sat, 25 Jan 1997 05:37:15 +0000
parents a62edcca9587
children 09bc76111e29
files lib/long-options.c
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lib/long-options.c
+++ b/lib/long-options.c
@@ -46,10 +46,8 @@
 {
   int c;
   int saved_opterr;
-  int saved_optind;
 
   saved_opterr = opterr;
-  saved_optind = optind;
 
   /* Don't print an error message for unrecognized options.  */
   opterr = 0;
@@ -75,6 +73,7 @@
   /* Restore previous value.  */
   opterr = saved_opterr;
 
-  /* Restore optind in case it has advanced past a leading `--'.  */
-  optind = saved_optind;
+  /* Reset this to zero so that getopt internals get initialized from
+     the probably-new parameters when/if getopt is called later.  */
+  optind = 0;
 }