aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-04-14 00:47:18 +0200
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-04-20 19:14:53 +0200
commit4292764e9e7b5084b64905d863b2fd9ca5632f36 (patch)
tree479daef95f9ed8d4560ddf212f23a6f96badabd5 /shell
parent536a13a396fc7e3c0648a5ab23ddbf04ef72fd0d (diff)
downloadbusybox-w32-4292764e9e7b5084b64905d863b2fd9ca5632f36.tar.gz
busybox-w32-4292764e9e7b5084b64905d863b2fd9ca5632f36.tar.bz2
busybox-w32-4292764e9e7b5084b64905d863b2fd9ca5632f36.zip
win32: ash: work around case-insensitive env vars
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 1f8f85639..7482ebf6f 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -13215,6 +13215,33 @@ init(void)
13215 struct stat st1, st2; 13215 struct stat st1, st2;
13216 13216
13217 initvar(); 13217 initvar();
13218
13219#if ENABLE_PLATFORM_MINGW32
13220 /*
13221 * case insensitive env names from Windows world
13222 *
13223 * Some standard env names such as PATH is named Path and so on
13224 * ash itself is case sensitive, so "Path" will confuse it, as
13225 * MSVC getenv() is case insensitive.
13226 *
13227 * We may end up having both Path and PATH. Then Path will be chosen
13228 * because it appears first.
13229 */
13230 for (envp = environ; envp && *envp; envp++)
13231 if (!strncasecmp(*envp, "PATH=", 5) &&
13232 strncmp(*envp, "PATH=", 5))
13233 break;
13234 if (envp && *envp) {
13235 char *start, *end;
13236 for (envp = environ; envp && *envp; envp++) {
13237 end = strchr(*envp, '=');
13238 if (!end)
13239 continue;
13240 for (start = *envp;start < end;start++)
13241 *start = toupper(*start);
13242 }
13243 }
13244#endif
13218 for (envp = environ; envp && *envp; envp++) { 13245 for (envp = environ; envp && *envp; envp++) {
13219 if (strchr(*envp, '=')) { 13246 if (strchr(*envp, '=')) {
13220 setvareq(*envp, VEXPORT|VTEXTFIXED); 13247 setvareq(*envp, VEXPORT|VTEXTFIXED);