diff options
-rw-r--r-- | libbb/lineedit.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index b685399..697f2a5 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -2035,7 +2035,13 @@ static void parse_and_put_prompt(const char *prmt_ptr) case 'W': /* basename of cur dir */ if (!cwd_buf) { const char *home; +#if ENABLE_SHELL_ASH + cwd_buf = state->sh_get_var + ? xstrdup(state->sh_get_var("PWD")) + : xrealloc_getcwd_or_warn(NULL); +#else cwd_buf = xrealloc_getcwd_or_warn(NULL); +#endif if (!cwd_buf) cwd_buf = (char *)bb_msg_unknown; else if ((home = get_homedir_or_NULL()) != NULL && home[0]) { |