diff options
Diffstat (limited to 'libbb/executable.c')
-rw-r--r-- | libbb/executable.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libbb/executable.c b/libbb/executable.c index 3a1d4ff44..5f0ff8c6e 100644 --- a/libbb/executable.c +++ b/libbb/executable.c | |||
@@ -28,6 +28,10 @@ int FAST_FUNC file_is_executable(const char *name) | |||
28 | * return NULL otherwise; (PATHp is undefined) | 28 | * return NULL otherwise; (PATHp is undefined) |
29 | * in all cases (*PATHp) contents will be trashed (s/:/NUL/). | 29 | * in all cases (*PATHp) contents will be trashed (s/:/NUL/). |
30 | */ | 30 | */ |
31 | #if !ENABLE_PLATFORM_MINGW32 | ||
32 | #define next_path_sep(s) strchr(s, ':') | ||
33 | #endif | ||
34 | |||
31 | char* FAST_FUNC find_executable(const char *filename, char **PATHp) | 35 | char* FAST_FUNC find_executable(const char *filename, char **PATHp) |
32 | { | 36 | { |
33 | /* About empty components in $PATH: | 37 | /* About empty components in $PATH: |
@@ -39,10 +43,13 @@ char* FAST_FUNC find_executable(const char *filename, char **PATHp) | |||
39 | * following the rest of the list. | 43 | * following the rest of the list. |
40 | */ | 44 | */ |
41 | char *p, *n; | 45 | char *p, *n; |
46 | #if ENABLE_PLATFORM_MINGW32 | ||
47 | char *w; | ||
48 | #endif | ||
42 | 49 | ||
43 | p = *PATHp; | 50 | p = *PATHp; |
44 | while (p) { | 51 | while (p) { |
45 | n = strchr(p, ':'); | 52 | n = (char*)next_path_sep(p); |
46 | if (n) | 53 | if (n) |
47 | *n++ = '\0'; | 54 | *n++ = '\0'; |
48 | p = concat_path_file( | 55 | p = concat_path_file( |
@@ -53,6 +60,13 @@ char* FAST_FUNC find_executable(const char *filename, char **PATHp) | |||
53 | *PATHp = n; | 60 | *PATHp = n; |
54 | return p; | 61 | return p; |
55 | } | 62 | } |
63 | #if ENABLE_PLATFORM_MINGW32 | ||
64 | else if ((w=file_is_win32_executable(p))) { | ||
65 | *PATHp = n; | ||
66 | free(p); | ||
67 | return w; | ||
68 | } | ||
69 | #endif | ||
56 | free(p); | 70 | free(p); |
57 | p = n; | 71 | p = n; |
58 | } /* on loop exit p == NULL */ | 72 | } /* on loop exit p == NULL */ |