aboutsummaryrefslogtreecommitdiff
path: root/libbb/lineedit.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r--libbb/lineedit.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 778511d16..06321825c 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -259,6 +259,16 @@ static const char *get_username_str(void)
259 259
260static NOINLINE const char *get_homedir_or_NULL(void) 260static NOINLINE const char *get_homedir_or_NULL(void)
261{ 261{
262 const char *home;
263
264#if ENABLE_SHELL_ASH || ENABLE_SHELL_HUSH
265 home = state->sh_get_var ? state->sh_get_var("HOME") : getenv("HOME");
266#else
267 home = getenv("HOME");
268#endif
269 if (home != NULL && home[0] != '\0')
270 return home;
271
262 if (!got_user_strings) 272 if (!got_user_strings)
263 get_user_strings(); 273 get_user_strings();
264 return home_pwd_buf; 274 return home_pwd_buf;
@@ -932,7 +942,7 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type)
932 continue; 942 continue;
933 } 943 }
934# endif 944# endif
935# if EDITING_HAS_get_exe_name 945# if ENABLE_SHELL_ASH || ENABLE_SHELL_HUSH
936 if (state->get_exe_name) { 946 if (state->get_exe_name) {
937 i = 0; 947 i = 0;
938 for (;;) { 948 for (;;) {