make the default prompt suck less when using fancy prompts

This commit is contained in:
Mike Frysinger 2006-06-06 06:26:12 +00:00
parent 75c6b7962d
commit 2a13175440

View File

@ -93,6 +93,15 @@ int mshdbg_rc = 0;
#endif /* MSHDEBUG */ #endif /* MSHDEBUG */
#ifdef CONFIG_FEATURE_SH_FANCY_PROMPT
# define DEFAULT_ROOT_PROMPT "\\u:\\w> "
# define DEFAULT_USER_PROMPT "\\u:\\w$ "
#else
# define DEFAULT_ROOT_PROMPT "# "
# define DEFAULT_USER_PROMPT "$ "
#endif
/* -------- sh.h -------- */ /* -------- sh.h -------- */
/* /*
* shell * shell
@ -877,9 +886,9 @@ int msh_main(int argc, char **argv)
#ifdef CONFIG_FEATURE_SH_FANCY_PROMPT #ifdef CONFIG_FEATURE_SH_FANCY_PROMPT
if (prompt->value == null) if (prompt->value == null)
#endif #endif
setval(prompt, "$ "); setval(prompt, DEFAULT_USER_PROMPT);
if (geteuid() == 0) { if (geteuid() == 0) {
setval(prompt, "# "); setval(prompt, DEFAULT_ROOT_PROMPT);
prompt->status &= ~EXPORT; prompt->status &= ~EXPORT;
} }
cprompt = lookup("PS2"); cprompt = lookup("PS2");