X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=shell%2Fmsh.c;h=62e6b6e01e1640eac11df651d8ea4228c519c002;hb=830d258dee032b0a6902e037ea4c57db8fb47d78;hp=8abbeff5a9c373201009baf6f2fd4b65bcd2bcdc;hpb=02d8fa48adcc5ee46262df787bd7e47e0e051cef;p=oweals%2Fbusybox.git diff --git a/shell/msh.c b/shell/msh.c index 8abbeff5a..62e6b6e01 100644 --- a/shell/msh.c +++ b/shell/msh.c @@ -27,6 +27,7 @@ * Original copyright notice is retained at the end of this file. */ +#include "busybox.h" #include #include #include @@ -46,14 +47,13 @@ #include #include "cmdedit.h" -#include "busybox.h" /* Conditional use of "register" keyword */ #define REGISTER register -#define MSHDEBUG 1 +/*#define MSHDEBUG 1*/ #ifdef MSHDEBUG int mshdbg = 0; @@ -93,6 +93,15 @@ int mshdbg_rc = 0; #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 -------- */ /* * shell @@ -877,9 +886,9 @@ int msh_main(int argc, char **argv) #ifdef CONFIG_FEATURE_SH_FANCY_PROMPT if (prompt->value == null) #endif - setval(prompt, "$ "); + setval(prompt, DEFAULT_USER_PROMPT); if (geteuid() == 0) { - setval(prompt, "# "); + setval(prompt, DEFAULT_ROOT_PROMPT); prompt->status &= ~EXPORT; } cprompt = lookup("PS2"); @@ -1621,7 +1630,7 @@ REGISTER int sub; static void initarea() { - brkaddr = malloc(AREASIZE); + brkaddr = xmalloc(AREASIZE); brktop = brkaddr + AREASIZE; while ((long) sbrk(0) & ALIGN) @@ -3031,7 +3040,7 @@ forkexec(REGISTER struct op *t, int *pin, int *pout, int act, char **wp) } else { /* put non-interactive processes into a different process group. * we don't support jobs, but this is at least sane: see Bug 659 */ - setpgrp(); + bb_setpgrp; } if (t->type == TPAREN)