summaryrefslogtreecommitdiff
path: root/shell/cmdedit.c
diff options
context:
space:
mode:
authorGlenn L McGrath2004-01-14 09:34:51 +0000
committerGlenn L McGrath2004-01-14 09:34:51 +0000
commit67285965f3d2c266ee37fec17d339b717752f8b0 (patch)
treeb0fcc72c3565c185b87641939ea6128a717f5a39 /shell/cmdedit.c
parent6a78631164a5b3ba279fde20011aaefa1a89e7db (diff)
downloadbusybox-67285965f3d2c266ee37fec17d339b717752f8b0.zip
busybox-67285965f3d2c266ee37fec17d339b717752f8b0.tar.gz
Vodz last_patch_122, Check $PATH at runtime to fix tab completion
Diffstat (limited to 'shell/cmdedit.c')
-rw-r--r--shell/cmdedit.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index 884489b..ec861df 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -43,6 +43,8 @@
#include "busybox.h"
+#include "../shell/cmdedit.h"
+
#ifdef CONFIG_LOCALE_SUPPORT
#define Isprint(c) isprint((c))
#else
@@ -609,14 +611,20 @@ enum {
FIND_FILE_ONLY = 2,
};
+#ifdef CONFIG_ASH
+const char *cmdedit_path_lookup;
+#else
+#define cmdedit_path_lookup getenv("PATH")
+#endif
+
static int path_parse(char ***p, int flags)
{
int npth;
- char *tmp;
- char *pth;
+ const char *tmp;
+ const char *pth;
/* if not setenv PATH variable, to search cur dir "." */
- if (flags != FIND_EXE_ONLY || (pth = getenv("PATH")) == 0 ||
+ if (flags != FIND_EXE_ONLY || (pth = cmdedit_path_lookup) == 0 ||
/* PATH=<empty> or PATH=:<empty> */
*pth == 0 || (*pth == ':' && *(pth + 1) == 0)) {
return 1;