diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2004-01-14 09:34:51 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2004-01-14 09:34:51 +0000 |
commit | 67285965f3d2c266ee37fec17d339b717752f8b0 (patch) | |
tree | b0fcc72c3565c185b87641939ea6128a717f5a39 | |
parent | 6a78631164a5b3ba279fde20011aaefa1a89e7db (diff) | |
download | busybox-w32-67285965f3d2c266ee37fec17d339b717752f8b0.tar.gz busybox-w32-67285965f3d2c266ee37fec17d339b717752f8b0.tar.bz2 busybox-w32-67285965f3d2c266ee37fec17d339b717752f8b0.zip |
Vodz last_patch_122, Check $PATH at runtime to fix tab completion
-rw-r--r-- | shell/ash.c | 3 | ||||
-rw-r--r-- | shell/cmdedit.c | 14 | ||||
-rw-r--r-- | shell/cmdedit.h | 4 |
3 files changed, 18 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c index b34f0583f..80145dae5 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -4117,6 +4117,9 @@ changepath(const char *newval) | |||
4117 | firstchange = 0; | 4117 | firstchange = 0; |
4118 | clearcmdentry(firstchange); | 4118 | clearcmdentry(firstchange); |
4119 | builtinloc = idx_bltin; | 4119 | builtinloc = idx_bltin; |
4120 | #ifdef CONFIG_FEATURE_COMMAND_EDITING | ||
4121 | cmdedit_path_lookup = newval; | ||
4122 | #endif | ||
4120 | } | 4123 | } |
4121 | 4124 | ||
4122 | 4125 | ||
diff --git a/shell/cmdedit.c b/shell/cmdedit.c index 884489b45..ec861df54 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c | |||
@@ -43,6 +43,8 @@ | |||
43 | 43 | ||
44 | #include "busybox.h" | 44 | #include "busybox.h" |
45 | 45 | ||
46 | #include "../shell/cmdedit.h" | ||
47 | |||
46 | #ifdef CONFIG_LOCALE_SUPPORT | 48 | #ifdef CONFIG_LOCALE_SUPPORT |
47 | #define Isprint(c) isprint((c)) | 49 | #define Isprint(c) isprint((c)) |
48 | #else | 50 | #else |
@@ -609,14 +611,20 @@ enum { | |||
609 | FIND_FILE_ONLY = 2, | 611 | FIND_FILE_ONLY = 2, |
610 | }; | 612 | }; |
611 | 613 | ||
614 | #ifdef CONFIG_ASH | ||
615 | const char *cmdedit_path_lookup; | ||
616 | #else | ||
617 | #define cmdedit_path_lookup getenv("PATH") | ||
618 | #endif | ||
619 | |||
612 | static int path_parse(char ***p, int flags) | 620 | static int path_parse(char ***p, int flags) |
613 | { | 621 | { |
614 | int npth; | 622 | int npth; |
615 | char *tmp; | 623 | const char *tmp; |
616 | char *pth; | 624 | const char *pth; |
617 | 625 | ||
618 | /* if not setenv PATH variable, to search cur dir "." */ | 626 | /* if not setenv PATH variable, to search cur dir "." */ |
619 | if (flags != FIND_EXE_ONLY || (pth = getenv("PATH")) == 0 || | 627 | if (flags != FIND_EXE_ONLY || (pth = cmdedit_path_lookup) == 0 || |
620 | /* PATH=<empty> or PATH=:<empty> */ | 628 | /* PATH=<empty> or PATH=:<empty> */ |
621 | *pth == 0 || (*pth == ':' && *(pth + 1) == 0)) { | 629 | *pth == 0 || (*pth == ':' && *(pth + 1) == 0)) { |
622 | return 1; | 630 | return 1; |
diff --git a/shell/cmdedit.h b/shell/cmdedit.h index 991dafcd1..4c0c09d76 100644 --- a/shell/cmdedit.h +++ b/shell/cmdedit.h | |||
@@ -3,6 +3,10 @@ | |||
3 | 3 | ||
4 | int cmdedit_read_input(char* promptStr, char* command); | 4 | int cmdedit_read_input(char* promptStr, char* command); |
5 | 5 | ||
6 | #ifdef CONFIG_ASH | ||
7 | extern const char *cmdedit_path_lookup; | ||
8 | #endif | ||
9 | |||
6 | #ifdef CONFIG_FEATURE_COMMAND_SAVEHISTORY | 10 | #ifdef CONFIG_FEATURE_COMMAND_SAVEHISTORY |
7 | void load_history ( const char *fromfile ); | 11 | void load_history ( const char *fromfile ); |
8 | void save_history ( const char *tofile ); | 12 | void save_history ( const char *tofile ); |