diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-14 00:47:18 +0200 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-09-14 11:04:35 +1000 |
commit | 8c3c113f03d539cf15dd855273ec12f98091feff (patch) | |
tree | 7a8070543e2e74eabdbc35a068d08e3e0cd89361 /shell | |
parent | cf1763dbb3c88a50171effb9be11954ee300de4d (diff) | |
download | busybox-w32-8c3c113f03d539cf15dd855273ec12f98091feff.tar.gz busybox-w32-8c3c113f03d539cf15dd855273ec12f98091feff.tar.bz2 busybox-w32-8c3c113f03d539cf15dd855273ec12f98091feff.zip |
win32: ash: work around case-insensitive env vars
Diffstat (limited to 'shell')
-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); |