diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2009-04-23 00:19:22 +1000 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2009-04-23 04:44:44 +1000 |
commit | 8884ff80ee749c86b284ecdfe2dbf41a0e68f55a (patch) | |
tree | a34fade982434c4dc4d53663d81115301f9819b9 /shell | |
parent | d335472a6631f1f30c23590a1764e804d0eb97a2 (diff) | |
download | busybox-w32-8884ff80ee749c86b284ecdfe2dbf41a0e68f55a.tar.gz busybox-w32-8884ff80ee749c86b284ecdfe2dbf41a0e68f55a.tar.bz2 busybox-w32-8884ff80ee749c86b284ecdfe2dbf41a0e68f55a.zip |
shell/ash: search for .exe automatically if .exe is not given
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c index cdbbeba33..b4e7b78a8 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -11265,13 +11265,33 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) | |||
11265 | #endif | 11265 | #endif |
11266 | if (errno != ENOENT && errno != ENOTDIR) | 11266 | if (errno != ENOENT && errno != ENOTDIR) |
11267 | e = errno; | 11267 | e = errno; |
11268 | #ifdef __MINGW32__ | ||
11269 | if (!strchr(name, '.')) { | ||
11270 | int len = strlen(fullname); | ||
11271 | fullname = stalloc(strlen(fullname) + 5); | ||
11272 | memcpy(fullname+len, ".exe", 5); | ||
11273 | stunalloc(fullname); | ||
11274 | while (stat(fullname, &statb) < 0) { | ||
11275 | #ifdef SYSV | ||
11276 | if (errno == EINTR) | ||
11277 | continue; | ||
11278 | #endif | ||
11279 | if (errno != ENOENT && errno != ENOTDIR) | ||
11280 | e = errno; | ||
11281 | |||
11282 | goto loop; | ||
11283 | } | ||
11284 | |||
11285 | break; | ||
11286 | } | ||
11287 | #endif | ||
11268 | goto loop; | 11288 | goto loop; |
11269 | } | 11289 | } |
11270 | e = EACCES; /* if we fail, this will be the error */ | 11290 | e = EACCES; /* if we fail, this will be the error */ |
11271 | if (!S_ISREG(statb.st_mode)) | 11291 | if (!S_ISREG(statb.st_mode)) |
11272 | continue; | 11292 | continue; |
11273 | if (pathopt) { /* this is a %func directory */ | 11293 | if (pathopt) { /* this is a %func directory */ |
11274 | stalloc(strlen(fullname) + 1); | 11294 | fullname = stalloc(strlen(fullname) + 1); |
11275 | readcmdfile(fullname); | 11295 | readcmdfile(fullname); |
11276 | cmdp = cmdlookup(name, 0); | 11296 | cmdp = cmdlookup(name, 0); |
11277 | if (cmdp == NULL || cmdp->cmdtype != CMDFUNCTION) | 11297 | if (cmdp == NULL || cmdp->cmdtype != CMDFUNCTION) |