1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-07-26 02:30:35 +02:00

(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.
This commit is contained in:
Jim Meyering
1997-01-25 05:37:15 +00:00
parent 50c04a9d3e
commit 175fb661e0
+3 -4
View File
@@ -46,10 +46,8 @@ parse_long_options (argc, argv, command_name, package, version, usage)
{
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 @@ parse_long_options (argc, argv, command_name, package, version, usage)
/* 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;
}