aboutsummaryrefslogtreecommitdiff
path: root/debianutils/which.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debianutils/which.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/debianutils/which.c b/debianutils/which.c
index c0f897809..af33ba72e 100644
--- a/debianutils/which.c
+++ b/debianutils/which.c
@@ -43,17 +43,33 @@ int which_main(int argc UNUSED_PARAM, char **argv)
43 43
44 do { 44 do {
45 int missing = 1; 45 int missing = 1;
46 char *p;
47
48#if ENABLE_FEATURE_PREFER_APPLETS
49 if (find_applet_by_name(*argv) >= 0 || strcmp(*argv, "busybox") == 0) {
50 missing = 0;
51 puts(*argv);
52 if (!option_mask32) /* -a not set */
53 break;
54 }
55#endif
46 56
47 /* If file contains a slash don't use PATH */ 57 /* If file contains a slash don't use PATH */
48 if (strchr(*argv, '/')) { 58 if (strchr(*argv, '/') || (ENABLE_PLATFORM_MINGW32 && strchr(*argv, '\\'))) {
49 if (file_is_executable(*argv)) { 59 if (file_is_executable(*argv)) {
50 missing = 0; 60 missing = 0;
51 puts(*argv); 61 puts(*argv);
52 } 62 }
63#if ENABLE_PLATFORM_MINGW32
64 else if ((p=file_is_win32_executable(*argv)) != NULL) {
65 missing = 0;
66 puts(p);
67 free(p);
68 }
69#endif
53 } else { 70 } else {
54 char *path; 71 char *path;
55 char *tmp; 72 char *tmp;
56 char *p;
57 73
58 path = tmp = xstrdup(env_path); 74 path = tmp = xstrdup(env_path);
59 while ((p = find_executable(*argv, &tmp)) != NULL) { 75 while ((p = find_executable(*argv, &tmp)) != NULL) {