aboutsummaryrefslogtreecommitdiff
path: root/debianutils/which.c
diff options
context:
space:
mode:
Diffstat (limited to 'debianutils/which.c')
-rw-r--r--debianutils/which.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/debianutils/which.c b/debianutils/which.c
index 6815768ab..fd3f53d3e 100644
--- a/debianutils/which.c
+++ b/debianutils/which.c
@@ -32,13 +32,6 @@
32 32
33#include "libbb.h" 33#include "libbb.h"
34 34
35#if ENABLE_PLATFORM_MINGW32 && ENABLE_FEATURE_SH_STANDALONE
36enum {
37 OPT_a = (1 << 0),
38 OPT_s = (1 << 1)
39};
40#endif
41
42int which_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 35int which_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
43int which_main(int argc UNUSED_PARAM, char **argv) 36int which_main(int argc UNUSED_PARAM, char **argv)
44{ 37{
@@ -47,7 +40,8 @@ int which_main(int argc UNUSED_PARAM, char **argv)
47 /* This sizeof(): bb_default_root_path is shorter than BB_PATH_ROOT_PATH */ 40 /* This sizeof(): bb_default_root_path is shorter than BB_PATH_ROOT_PATH */
48 char buf[sizeof(BB_PATH_ROOT_PATH)]; 41 char buf[sizeof(BB_PATH_ROOT_PATH)];
49#if ENABLE_PLATFORM_MINGW32 && ENABLE_FEATURE_SH_STANDALONE 42#if ENABLE_PLATFORM_MINGW32 && ENABLE_FEATURE_SH_STANDALONE
50 int sh_standalone; 43 /* 'Which' in argv[0] indicates we were run from a standalone shell */
44 int sh_standalone = argv[0][0] == 'W';
51#endif 45#endif
52 46
53 env_path = getenv("PATH"); 47 env_path = getenv("PATH");
@@ -55,14 +49,7 @@ int which_main(int argc UNUSED_PARAM, char **argv)
55 /* env_path must be writable, and must not alloc, so... */ 49 /* env_path must be writable, and must not alloc, so... */
56 env_path = strcpy(buf, bb_default_root_path); 50 env_path = strcpy(buf, bb_default_root_path);
57 51
58#if ENABLE_PLATFORM_MINGW32 && ENABLE_FEATURE_SH_STANDALONE
59 /* '-s' option indicates we were run from a standalone shell */
60 getopt32(argv, "^" "as" "\0" "-1"/*at least one arg*/);
61 sh_standalone = option_mask32 & OPT_s;
62 option_mask32 &= ~OPT_s;
63#else
64 getopt32(argv, "^" "a" "\0" "-1"/*at least one arg*/); 52 getopt32(argv, "^" "a" "\0" "-1"/*at least one arg*/);
65#endif
66 argv += optind; 53 argv += optind;
67 54
68 do { 55 do {