Vodz last_patch_122, Check $PATH at runtime to fix tab completion
authorGlenn L McGrath <bug1@ihug.co.nz>
Wed, 14 Jan 2004 09:34:51 +0000 (09:34 -0000)
committerGlenn L McGrath <bug1@ihug.co.nz>
Wed, 14 Jan 2004 09:34:51 +0000 (09:34 -0000)
shell/ash.c
shell/cmdedit.c
shell/cmdedit.h

index b34f0583f0d38222b1f3afca13aec5f730770aba..80145dae5fc3e7d79b185b72b753d91e4e9d472f 100644 (file)
@@ -4117,6 +4117,9 @@ changepath(const char *newval)
                firstchange = 0;
        clearcmdentry(firstchange);
        builtinloc = idx_bltin;
+#ifdef CONFIG_FEATURE_COMMAND_EDITING
+       cmdedit_path_lookup = newval;
+#endif
 }
 
 
index 884489b4541fc8760954d0b39d74decee89adc5b..ec861df54684bb0fa93913fa0954c32700aaf629 100644 (file)
@@ -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;
index 991dafcd1ded39ed2ef2cbb3570902ac3e7c83aa..4c0c09d764433b5c2c35b69344400e8389ab27ba 100644 (file)
@@ -3,6 +3,10 @@
 
 int     cmdedit_read_input(char* promptStr, char* command);
 
+#ifdef CONFIG_ASH
+extern const char *cmdedit_path_lookup;
+#endif
+
 #ifdef CONFIG_FEATURE_COMMAND_SAVEHISTORY
 void    load_history ( const char *fromfile );
 void    save_history ( const char *tofile );