diff options
Diffstat (limited to 'win32')
| -rw-r--r-- | win32/mingw.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index d3daf8315..f96b5b49a 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
| @@ -2464,3 +2464,29 @@ char *xappendword(const char *str, const char *word) | |||
| 2464 | free((void *)str); | 2464 | free((void *)str); |
| 2465 | return newstr; | 2465 | return newstr; |
| 2466 | } | 2466 | } |
| 2467 | |||
| 2468 | /* | ||
| 2469 | * Detect if the environment contains certain mixed-case names: | ||
| 2470 | * | ||
| 2471 | * Path is present in a standard Windows environment | ||
| 2472 | * ComSpec is present in WINE | ||
| 2473 | * ProgramData is present in Cygwin/MSYS2 | ||
| 2474 | */ | ||
| 2475 | int | ||
| 2476 | windows_env(void) | ||
| 2477 | { | ||
| 2478 | const char *names = "PATH=\0""COMSPEC=\0""PROGRAMDATA=\0"; | ||
| 2479 | const char *n; | ||
| 2480 | |||
| 2481 | for (char **envp = environ; envp && *envp; envp++) { | ||
| 2482 | for (n = names; *n; ) { | ||
| 2483 | if (is_prefixed_with_case(*envp, n) && | ||
| 2484 | !is_prefixed_with(*envp, n)) { | ||
| 2485 | return TRUE; | ||
| 2486 | } | ||
| 2487 | while (*n++) | ||
| 2488 | ; | ||
| 2489 | } | ||
| 2490 | } | ||
| 2491 | return FALSE; | ||
| 2492 | } | ||
