aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2022-05-10 15:12:52 +0100
committerRon Yorston <rmy@pobox.com>2022-05-10 15:12:52 +0100
commit2cf6277bbbc925f2c6267f5fb10d6c325dc0b1dd (patch)
treef59c02f5743bb4decf33c1310f9ef37bee00a8d4
parent342fe91f3dafbddb656a0c478d5c495f9422d3bf (diff)
downloadbusybox-w32-2cf6277bbbc925f2c6267f5fb10d6c325dc0b1dd.tar.gz
busybox-w32-2cf6277bbbc925f2c6267f5fb10d6c325dc0b1dd.tar.bz2
busybox-w32-2cf6277bbbc925f2c6267f5fb10d6c325dc0b1dd.zip
win32: make default PATH more likely to work
The default PATH defined as BB_PATH_ROOT_PATH is used: - to set PATH in the shell if the environment variable doesn't exist; - as the default in 'which' if there's no PATH env var; - when the option 'command -p' is given. Replace the Unix-centric default with something more likely to work on Microsoft Windows. No guarantees, though. (GitHub issue #253)
-rw-r--r--include/libbb.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 6d6fc28f0..6e4e7583f 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -2354,10 +2354,19 @@ extern const char bb_busybox_exec_path[] ALIGN1;
2354#endif 2354#endif
2355#if !ENABLE_PLATFORM_MINGW32 2355#if !ENABLE_PLATFORM_MINGW32
2356#define BB_PATH_ROOT_PATH "PATH=/sbin:/usr/sbin:/bin:/usr/bin" BB_ADDITIONAL_PATH 2356#define BB_PATH_ROOT_PATH "PATH=/sbin:/usr/sbin:/bin:/usr/bin" BB_ADDITIONAL_PATH
2357extern const char bb_PATH_root_path[] ALIGN1; /* BB_PATH_ROOT_PATH */
2358#define bb_default_root_path (bb_PATH_root_path + sizeof("PATH"))
2359/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
2360 * but I want to save a few bytes here:
2361 */
2362#define bb_default_path (bb_PATH_root_path + sizeof("PATH=/sbin:/usr/sbin"))
2357#define PATH_SEP ':' 2363#define PATH_SEP ':'
2358#define PATH_SEP_STR ":" 2364#define PATH_SEP_STR ":"
2359#else 2365#else
2360#define BB_PATH_ROOT_PATH "PATH=/sbin;/usr/sbin;/bin;/usr/bin" BB_ADDITIONAL_PATH 2366#define BB_PATH_ROOT_PATH "PATH=C:/Windows/System32;C:/Windows" BB_ADDITIONAL_PATH
2367extern const char bb_PATH_root_path[] ALIGN1; /* BB_PATH_ROOT_PATH */
2368#define bb_default_root_path (bb_PATH_root_path + sizeof("PATH"))
2369#define bb_default_path (bb_PATH_root_path + sizeof("PATH"))
2361#define PATH_SEP ';' 2370#define PATH_SEP ';'
2362#define PATH_SEP_STR ";" 2371#define PATH_SEP_STR ";"
2363extern const char bbvar[] ALIGN1; 2372extern const char bbvar[] ALIGN1;
@@ -2366,12 +2375,6 @@ extern const char bbvar[] ALIGN1;
2366#define BB_SKIP_ANSI_EMULATION bbafter(BB_OVERRIDE_APPLETS) 2375#define BB_SKIP_ANSI_EMULATION bbafter(BB_OVERRIDE_APPLETS)
2367#define BB_SYSTEMROOT bbafter(BB_SKIP_ANSI_EMULATION) 2376#define BB_SYSTEMROOT bbafter(BB_SKIP_ANSI_EMULATION)
2368#endif 2377#endif
2369extern const char bb_PATH_root_path[] ALIGN1; /* BB_PATH_ROOT_PATH */
2370#define bb_default_root_path (bb_PATH_root_path + sizeof("PATH"))
2371/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
2372 * but I want to save a few bytes here:
2373 */
2374#define bb_default_path (bb_PATH_root_path + sizeof("PATH=/sbin:/usr/sbin"))
2375 2378
2376extern const int const_int_0; 2379extern const int const_int_0;
2377//extern const int const_int_1; 2380//extern const int const_int_1;