On Mon, 27 Apr 2020, Steve Lhomme wrote:

The API is available since Windows XP and available in UWP for win8 and win10.

This avoids relying on getenv() from winstorecompat that returns NULL and can't
be reimplemented in a clean way.
---
mingw-w64-crt/misc/getopt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mingw-w64-crt/misc/getopt.c b/mingw-w64-crt/misc/getopt.c
index ac1fda42..ac7f9fe1 100644
--- a/mingw-w64-crt/misc/getopt.c
+++ b/mingw-w64-crt/misc/getopt.c
@@ -345,7 +345,7 @@ getopt_internal(int nargc, char * const *nargv, const char 
*options,
         *                 optreset != 0 for GNU compatibility.
         */
        if (posixly_correct == -1 || optreset != 0)
-               posixly_correct = (getenv("POSIXLY_CORRECT") != NULL);
+               posixly_correct = (GetEnvironmentVariableW(L"POSIXLY_CORRECT", 
NULL, 0) != 0);
        if (*options == '-')
                flags |= FLAG_ALLARGS;
        else if (posixly_correct || *options == '+')
--
2.17.1

This looks good, so I pushed it.

// Martin



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to