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