diff options
-rw-r--r-- | shell/ash.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c index ed892db98..64e64d95e 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -13216,6 +13216,33 @@ init(void) | |||
13216 | struct stat st1, st2; | 13216 | struct stat st1, st2; |
13217 | 13217 | ||
13218 | initvar(); | 13218 | initvar(); |
13219 | |||
13220 | #if ENABLE_PLATFORM_MINGW32 | ||
13221 | /* | ||
13222 | * case insensitive env names from Windows world | ||
13223 | * | ||
13224 | * Some standard env names such as PATH is named Path and so on | ||
13225 | * ash itself is case sensitive, so "Path" will confuse it, as | ||
13226 | * MSVC getenv() is case insensitive. | ||
13227 | * | ||
13228 | * We may end up having both Path and PATH. Then Path will be chosen | ||
13229 | * because it appears first. | ||
13230 | */ | ||
13231 | for (envp = environ; envp && *envp; envp++) | ||
13232 | if (!strncasecmp(*envp, "PATH=", 5) && | ||
13233 | strncmp(*envp, "PATH=", 5)) | ||
13234 | break; | ||
13235 | if (envp && *envp) { | ||
13236 | char *start, *end; | ||
13237 | for (envp = environ; envp && *envp; envp++) { | ||
13238 | end = strchr(*envp, '='); | ||
13239 | if (!end) | ||
13240 | continue; | ||
13241 | for (start = *envp;start < end;start++) | ||
13242 | *start = toupper(*start); | ||
13243 | } | ||
13244 | } | ||
13245 | #endif | ||
13219 | for (envp = environ; envp && *envp; envp++) { | 13246 | for (envp = environ; envp && *envp; envp++) { |
13220 | if (strchr(*envp, '=')) { | 13247 | if (strchr(*envp, '=')) { |
13221 | setvareq(*envp, VEXPORT|VTEXTFIXED); | 13248 | setvareq(*envp, VEXPORT|VTEXTFIXED); |