aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
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)
249 } 249 }
250} 250}
251 251
252static const char *get_username_str(void)
253{
254 if (!got_user_strings)
255 get_user_strings();
256 return user_buf ? user_buf : "";
257 /* btw, bash uses "I have no name!" string if uid has no entry */
258}
259
260static NOINLINE const char *get_homedir_or_NULL(void) 252static NOINLINE const char *get_homedir_or_NULL(void)
261{ 253{
262 const char *home; 254 const char *home;
@@ -275,6 +267,16 @@ static NOINLINE const char *get_homedir_or_NULL(void)
275} 267}
276#endif 268#endif
277 269
270#if ENABLE_FEATURE_EDITING_FANCY_PROMPT
271static const char *get_username_str(void)
272{
273 if (!got_user_strings)
274 get_user_strings();
275 return user_buf ? user_buf : "";
276 /* btw, bash uses "I have no name!" string if uid has no entry */
277}
278#endif
279
278#if ENABLE_UNICODE_SUPPORT 280#if ENABLE_UNICODE_SUPPORT
279static size_t load_string(const char *src) 281static size_t load_string(const char *src)
280{ 282{
@@ -2035,13 +2037,13 @@ static void parse_and_put_prompt(const char *prmt_ptr)
2035 case 'W': /* basename of cur dir */ 2037 case 'W': /* basename of cur dir */
2036 if (!cwd_buf) { 2038 if (!cwd_buf) {
2037 const char *home; 2039 const char *home;
2038#if ENABLE_SHELL_ASH 2040# if EDITING_HAS_sh_get_var
2039 cwd_buf = state->sh_get_var 2041 cwd_buf = state->sh_get_var
2040 ? xstrdup(state->sh_get_var("PWD")) 2042 ? xstrdup(state->sh_get_var("PWD"))
2041 : xrealloc_getcwd_or_warn(NULL); 2043 : xrealloc_getcwd_or_warn(NULL);
2042#else 2044# else
2043 cwd_buf = xrealloc_getcwd_or_warn(NULL); 2045 cwd_buf = xrealloc_getcwd_or_warn(NULL);
2044#endif 2046# endif
2045 if (!cwd_buf) 2047 if (!cwd_buf)
2046 cwd_buf = (char *)bb_msg_unknown; 2048 cwd_buf = (char *)bb_msg_unknown;
2047 else if ((home = get_homedir_or_NULL()) != NULL && home[0]) { 2049 else if ((home = get_homedir_or_NULL()) != NULL && home[0]) {