aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Config.h10
-rw-r--r--lash.c20
-rw-r--r--sh.c20
-rw-r--r--shell/lash.c20
4 files changed, 68 insertions, 2 deletions
diff --git a/Config.h b/Config.h
index b11d84903..3a5aa6182 100644
--- a/Config.h
+++ b/Config.h
@@ -262,9 +262,15 @@
// Only relevant if BB_SH is enabled.
#define BB_FEATURE_SH_TAB_COMPLETION
//
+// Enable a simpler shell prompt of the form "path #" instead of the default
+// "[username@hostname path]#". Some deeply embedded systems don't have
+// usernames or even hostnames and the default prompt can look rather hideous
+// on them. Uncomment this option for a simpler, path-only prompt (which was
+// the default until around BusyBox-0.48):
+#define BB_FEATURE_SH_SIMPLE_PROMPT
+//
// Attempts to match usernames in a ~-prefixed path
-// XXX: Doesn't work without NSS, off by default
-//#define BB_FEATURE_USERNAME_COMPLETION /* require NSS */
+//#define BB_FEATURE_USERNAME_COMPLETION
//
//Turn on extra fbset options
//#define BB_FEATURE_FBSET_FANCY
diff --git a/lash.c b/lash.c
index bd6945605..b3bdcc986 100644
--- a/lash.c
+++ b/lash.c
@@ -779,6 +779,24 @@ static void restore_redirects(int squirrel[])
}
}
+#if defined(BB_FEATURE_SH_SIMPLE_PROMPT)
+static char* setup_prompt_string(int state)
+{
+ char prompt_str[BUFSIZ];
+
+ /* Set up the prompt */
+ if (state == 0) {
+ /* simple prompt */
+ sprintf(prompt_str, "%s %s", cwd, ( geteuid() != 0 ) ? "$ ":"# ");
+ } else {
+ strcpy(prompt_str,"> ");
+ }
+
+ return(strdup(prompt_str)); /* Must free this memory */
+}
+
+#else
+
static char* setup_prompt_string(int state)
{
char user[9],buf[255],*s;
@@ -810,6 +828,8 @@ static char* setup_prompt_string(int state)
return(strdup(prompt_str)); /* Must free this memory */
}
+#endif
+
static int get_command(FILE * source, char *command)
{
char *prompt_str;
diff --git a/sh.c b/sh.c
index bd6945605..b3bdcc986 100644
--- a/sh.c
+++ b/sh.c
@@ -779,6 +779,24 @@ static void restore_redirects(int squirrel[])
}
}
+#if defined(BB_FEATURE_SH_SIMPLE_PROMPT)
+static char* setup_prompt_string(int state)
+{
+ char prompt_str[BUFSIZ];
+
+ /* Set up the prompt */
+ if (state == 0) {
+ /* simple prompt */
+ sprintf(prompt_str, "%s %s", cwd, ( geteuid() != 0 ) ? "$ ":"# ");
+ } else {
+ strcpy(prompt_str,"> ");
+ }
+
+ return(strdup(prompt_str)); /* Must free this memory */
+}
+
+#else
+
static char* setup_prompt_string(int state)
{
char user[9],buf[255],*s;
@@ -810,6 +828,8 @@ static char* setup_prompt_string(int state)
return(strdup(prompt_str)); /* Must free this memory */
}
+#endif
+
static int get_command(FILE * source, char *command)
{
char *prompt_str;
diff --git a/shell/lash.c b/shell/lash.c
index bd6945605..b3bdcc986 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -779,6 +779,24 @@ static void restore_redirects(int squirrel[])
}
}
+#if defined(BB_FEATURE_SH_SIMPLE_PROMPT)
+static char* setup_prompt_string(int state)
+{
+ char prompt_str[BUFSIZ];
+
+ /* Set up the prompt */
+ if (state == 0) {
+ /* simple prompt */
+ sprintf(prompt_str, "%s %s", cwd, ( geteuid() != 0 ) ? "$ ":"# ");
+ } else {
+ strcpy(prompt_str,"> ");
+ }
+
+ return(strdup(prompt_str)); /* Must free this memory */
+}
+
+#else
+
static char* setup_prompt_string(int state)
{
char user[9],buf[255],*s;
@@ -810,6 +828,8 @@ static char* setup_prompt_string(int state)
return(strdup(prompt_str)); /* Must free this memory */
}
+#endif
+
static int get_command(FILE * source, char *command)
{
char *prompt_str;