@@ -2093,6 +2093,22 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen)
2093
2093
return -1 ;
2094
2094
}
2095
2095
2096
+ static void setup_windows_environment ()
2097
+ {
2098
+ /* on Windows it is TMP and TEMP */
2099
+ if (!getenv ("TMPDIR" )) {
2100
+ const char * tmp = getenv ("TMP" );
2101
+ if (!tmp )
2102
+ tmp = getenv ("TEMP" );
2103
+ if (tmp )
2104
+ setenv ("TMPDIR" , tmp , 1 );
2105
+ }
2106
+
2107
+ /* simulate TERM to enable auto-color (see color.c) */
2108
+ if (!getenv ("TERM" ))
2109
+ setenv ("TERM" , "cygwin" , 1 );
2110
+ }
2111
+
2096
2112
/*
2097
2113
* Disable MSVCRT command line wildcard expansion (__getmainargs called from
2098
2114
* mingw startup code, see init.c in mingw runtime).
@@ -2189,19 +2205,7 @@ void mingw_startup()
2189
2205
qsort (environ , i , sizeof (char * ), compareenv );
2190
2206
2191
2207
/* fix Windows specific environment settings */
2192
-
2193
- /* on Windows it is TMP and TEMP */
2194
- if (!mingw_getenv ("TMPDIR" )) {
2195
- const char * tmp = mingw_getenv ("TMP" );
2196
- if (!tmp )
2197
- tmp = mingw_getenv ("TEMP" );
2198
- if (tmp )
2199
- setenv ("TMPDIR" , tmp , 1 );
2200
- }
2201
-
2202
- /* simulate TERM to enable auto-color (see color.c) */
2203
- if (!getenv ("TERM" ))
2204
- setenv ("TERM" , "cygwin" , 1 );
2208
+ setup_windows_environment ();
2205
2209
2206
2210
/*
2207
2211
* Avoid a segmentation fault when cURL tries to set the CHARSET
0 commit comments