From: Bruno Haible Date: Mon, 30 Jun 2025 00:49:51 +0000 (+0200) Subject: options: Support use in a shared library on mingw, part 2. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98a2811ea085277ac9588b1cf9e44efc3ee41c6c;p=thirdparty%2Fgnulib.git options: Support use in a shared library on mingw, part 2. * lib/options.c (_gl_get_next_option): Copy the optind value also as an input parameter. --- diff --git a/lib/options.c b/lib/options.c index 6ff6064698..07455ff423 100644 --- a/lib/options.c +++ b/lib/options.c @@ -132,6 +132,11 @@ get_next_option (void) fprintf (stderr, "fatal: start_options has not been invoked\n"); abort (); } +#ifdef __MINGW32__ + /* See below for a general explanation. optind is not only an output of + getopt_long(), but also an input. */ + optind = *optind_p; +#endif int ret = getopt_long (state.argc, state.argv, state.short_options, state.long_options, NULL); if (ret > 1)