summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-01-03 08:28:16 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2023-01-03 08:28:16 +0100
commit27be0e8cfeb6f0f7a66bbfb2a6ca23d5a064e6ab (patch)
treebf56f6d0d922cf3eefb0e413e9326a2e60373dd8 /libbb
parent8ed57db65ba66709d3b4061c4f03766f1fe58780 (diff)
downloadbusybox-27be0e8cfeb6f0f7a66bbfb2a6ca23d5a064e6ab.tar.gz
shell: fix compile failures in some configs
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/lineedit.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 697f2a577..d6b2e76ff 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -249,14 +249,6 @@ static void get_user_strings(void)
}
}
-static const char *get_username_str(void)
-{
- if (!got_user_strings)
- get_user_strings();
- return user_buf ? user_buf : "";
- /* btw, bash uses "I have no name!" string if uid has no entry */
-}
-
static NOINLINE const char *get_homedir_or_NULL(void)
{
const char *home;
@@ -275,6 +267,16 @@ static NOINLINE const char *get_homedir_or_NULL(void)
}
#endif
+#if ENABLE_FEATURE_EDITING_FANCY_PROMPT
+static const char *get_username_str(void)
+{
+ if (!got_user_strings)
+ get_user_strings();
+ return user_buf ? user_buf : "";
+ /* btw, bash uses "I have no name!" string if uid has no entry */
+}
+#endif
+
#if ENABLE_UNICODE_SUPPORT
static size_t load_string(const char *src)
{
@@ -2035,13 +2037,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
+# if EDITING_HAS_sh_get_var
cwd_buf = state->sh_get_var
? xstrdup(state->sh_get_var("PWD"))
: xrealloc_getcwd_or_warn(NULL);
-#else
+# else
cwd_buf = xrealloc_getcwd_or_warn(NULL);
-#endif
+# endif
if (!cwd_buf)
cwd_buf = (char *)bb_msg_unknown;
else if ((home = get_homedir_or_NULL()) != NULL && home[0]) {