]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
options: Support use in a shared library on mingw, part 2.
authorBruno Haible <bruno@clisp.org>
Mon, 30 Jun 2025 00:49:51 +0000 (02:49 +0200)
committerBruno Haible <bruno@clisp.org>
Mon, 30 Jun 2025 00:49:51 +0000 (02:49 +0200)
* lib/options.c (_gl_get_next_option): Copy the optind value also as an input
parameter.

lib/options.c

index 6ff6064698dfed438bce6c80d88e9e5d35c4fd53..07455ff4236f267ded5fb528b91b1dc18e8e4e43 100644 (file)
@@ -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)