diff options
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/ash.c | 49 |
1 files changed, 4 insertions, 45 deletions
diff --git a/shell/ash.c b/shell/ash.c index 95bf81db3..d81d27d25 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -452,47 +452,6 @@ static void forkshell_print(FILE *fp0, struct forkshell *fs, const char **notes) | |||
| 452 | # endif | 452 | # endif |
| 453 | #endif | 453 | #endif |
| 454 | 454 | ||
| 455 | #if ENABLE_PLATFORM_MINGW32 && NUM_APPLETS > 1 && \ | ||
| 456 | (ENABLE_FEATURE_PREFER_APPLETS || ENABLE_FEATURE_SH_STANDALONE) | ||
| 457 | static const char *ash_path; | ||
| 458 | |||
| 459 | const char * | ||
| 460 | get_ash_path(void) | ||
| 461 | { | ||
| 462 | return ash_path; | ||
| 463 | } | ||
| 464 | |||
| 465 | static int NOINLINE | ||
| 466 | ash_applet_by_name(const char *name, const char *path) | ||
| 467 | { | ||
| 468 | int ret; | ||
| 469 | |||
| 470 | ash_path = path; | ||
| 471 | ret = find_applet_by_name(name); | ||
| 472 | ash_path = NULL; | ||
| 473 | |||
| 474 | return ret; | ||
| 475 | } | ||
| 476 | |||
| 477 | static int | ||
| 478 | ash_applet_preferred(const char *name, const char *path) | ||
| 479 | { | ||
| 480 | int ret; | ||
| 481 | |||
| 482 | ash_path = path; | ||
| 483 | ret = is_applet_preferred(name); | ||
| 484 | ash_path = NULL; | ||
| 485 | |||
| 486 | return ret; | ||
| 487 | } | ||
| 488 | # define find_applet_by_name(n, p) ash_applet_by_name(n, p) | ||
| 489 | # define is_applet_preferred(n, p) ash_applet_preferred(n, p) | ||
| 490 | #else | ||
| 491 | # define find_applet_by_name(n, p) find_applet_by_name(n) | ||
| 492 | # undef is_applet_preferred | ||
| 493 | # define is_applet_preferred(n, p) (1) | ||
| 494 | #endif | ||
| 495 | |||
| 496 | /* ============ Hash table sizes. Configurable. */ | 455 | /* ============ Hash table sizes. Configurable. */ |
| 497 | 456 | ||
| 498 | #define VTABSIZE 39 | 457 | #define VTABSIZE 39 |
| @@ -9238,7 +9197,7 @@ static void shellexec(char *prog, char **argv, const char *path, int idx) | |||
| 9238 | if (has_path(prog) | 9197 | if (has_path(prog) |
| 9239 | #endif | 9198 | #endif |
| 9240 | #if ENABLE_FEATURE_SH_STANDALONE | 9199 | #if ENABLE_FEATURE_SH_STANDALONE |
| 9241 | || (applet_no = find_applet_by_name(prog, path)) >= 0 | 9200 | || (applet_no = find_applet_by_name_with_path(prog, path)) >= 0 |
| 9242 | #endif | 9201 | #endif |
| 9243 | ) { | 9202 | ) { |
| 9244 | #if ENABLE_PLATFORM_MINGW32 | 9203 | #if ENABLE_PLATFORM_MINGW32 |
| @@ -9259,7 +9218,7 @@ static void shellexec(char *prog, char **argv, const char *path, int idx) | |||
| 9259 | if (unix_path(prog)) { | 9218 | if (unix_path(prog)) { |
| 9260 | const char *name = bb_basename(prog); | 9219 | const char *name = bb_basename(prog); |
| 9261 | # if ENABLE_FEATURE_SH_STANDALONE | 9220 | # if ENABLE_FEATURE_SH_STANDALONE |
| 9262 | if ((applet_no = find_applet_by_name(name, path)) >= 0) { | 9221 | if ((applet_no = find_applet_by_name_with_path(name, path)) >= 0) { |
| 9263 | tryexec(applet_no, name, argv, envp); | 9222 | tryexec(applet_no, name, argv, envp); |
| 9264 | e = errno; | 9223 | e = errno; |
| 9265 | } | 9224 | } |
| @@ -15074,7 +15033,7 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) | |||
| 15074 | name = (char *)bb_basename(name); | 15033 | name = (char *)bb_basename(name); |
| 15075 | if ( | 15034 | if ( |
| 15076 | # if ENABLE_FEATURE_SH_STANDALONE | 15035 | # if ENABLE_FEATURE_SH_STANDALONE |
| 15077 | find_applet_by_name(name, path) >= 0 || | 15036 | find_applet_by_name_with_path(name, path) >= 0 || |
| 15078 | # endif | 15037 | # endif |
| 15079 | !find_builtin(bb_basename(name)) | 15038 | !find_builtin(bb_basename(name)) |
| 15080 | ) { | 15039 | ) { |
| @@ -15145,7 +15104,7 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) | |||
| 15145 | 15104 | ||
| 15146 | #if ENABLE_FEATURE_SH_STANDALONE | 15105 | #if ENABLE_FEATURE_SH_STANDALONE |
| 15147 | { | 15106 | { |
| 15148 | int applet_no = find_applet_by_name(name, path); | 15107 | int applet_no = find_applet_by_name_with_path(name, path); |
| 15149 | if (applet_no >= 0) { | 15108 | if (applet_no >= 0) { |
| 15150 | entry->cmdtype = CMDNORMAL; | 15109 | entry->cmdtype = CMDNORMAL; |
| 15151 | entry->u.index = -2 - applet_no; | 15110 | entry->u.index = -2 - applet_no; |
