aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-02-13 10:52:43 +0000
committerRon Yorston <rmy@pobox.com>2018-02-13 10:52:43 +0000
commit5bf7067e61f202f023d70f38d14bb66799a27074 (patch)
tree7aad577eb0d69b96813124f071b760ce9c2eb327
parentdc19a361bd6c6df30338371532691bbc7f7126bb (diff)
downloadbusybox-w32-5bf7067e61f202f023d70f38d14bb66799a27074.tar.gz
busybox-w32-5bf7067e61f202f023d70f38d14bb66799a27074.tar.bz2
busybox-w32-5bf7067e61f202f023d70f38d14bb66799a27074.zip
which: treat busybox as a special case
Busybox knows the path to its own executable even if it isn't on PATH. Treat this as a special case and print the path. `which busybox` is used in testsuite/busybox.tests
-rw-r--r--debianutils/which.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/debianutils/which.c b/debianutils/which.c
index 9613c6fc5..13f922615 100644
--- a/debianutils/which.c
+++ b/debianutils/which.c
@@ -48,7 +48,14 @@ int which_main(int argc UNUSED_PARAM, char **argv)
48 char *p; 48 char *p;
49 49
50#if ENABLE_FEATURE_SH_STANDALONE 50#if ENABLE_FEATURE_SH_STANDALONE
51 if (find_applet_by_name(*argv) >= 0 || 51 if (strcmp(*argv, "busybox") == 0 &&
52 is_suffixed_with(bb_busybox_exec_path, "busybox.exe")) {
53 missing = 0;
54 puts(bb_busybox_exec_path);
55 if (!option_mask32) /* -a not set */
56 break;
57 }
58 else if (find_applet_by_name(*argv) >= 0 ||
52 is_prefixed_with(*argv, "busybox")) { 59 is_prefixed_with(*argv, "busybox")) {
53 missing = 0; 60 missing = 0;
54 puts(*argv); 61 puts(*argv);