- Changed name of BB_FEATURE_SIMPLE_PROMPT to BB_FEATURE_SH_SIMPLE_PROMPT

- Set BB_FEATURE_SH_STANDALONE_SHELL and BB_FEATURE_SH_APPLETS_ALWAYS_WIN to
   be off by default
 - Set BB_FEATURE_SH_SIMPLE_PROMPT to be on by default
 - Added some more magic to the Olympus section to make all the dependencies
   on the shell, cmdline editing, tab completion and friend work properly.
 - Tidied up the Olympus section with some whitespace. Checked the various
   scrips that parse through there and the extra whitespace shouldn't break
   anything.
This commit is contained in:
Mark Whitley 2001-03-14 00:29:14 +00:00
parent c75f83d874
commit f594986b37
6 changed files with 94 additions and 84 deletions

128
Config.h
View File

@ -240,7 +240,7 @@
#define BB_FEATURE_SORT_REVERSE #define BB_FEATURE_SORT_REVERSE
// //
// Enable command line editing in the shell. // Enable command line editing in the shell.
// Only relevant if BB_SH is enabled. // Only relevant if BB_SH is enabled. On by default.
#define BB_FEATURE_COMMAND_EDITING #define BB_FEATURE_COMMAND_EDITING
// //
// Enable tab completion in the shell. This is now working quite nicely. // Enable tab completion in the shell. This is now working quite nicely.
@ -252,9 +252,9 @@
// //
//Allow the shell to invoke all the compiled in BusyBox applets as if they //Allow the shell to invoke all the compiled in BusyBox applets as if they
//were shell builtins. Nice for staticly linking an emergency rescue shell, //were shell builtins. Nice for staticly linking an emergency rescue shell,
//among other things. //among other things. Off by default.
// Only relevant if BB_SH is enabled. // Only relevant if BB_SH is enabled.
#define BB_FEATURE_SH_STANDALONE_SHELL //#define BB_FEATURE_SH_STANDALONE_SHELL
// //
//When this is enabled, busybox shell applets can be called using full path //When this is enabled, busybox shell applets can be called using full path
//names. This causes applets (i.e., most busybox commands) to override //names. This causes applets (i.e., most busybox commands) to override
@ -262,14 +262,15 @@
//will use BusyBox cat even if /bin/cat exists on the filesystem and is _not_ //will use BusyBox cat even if /bin/cat exists on the filesystem and is _not_
//busybox. Some systems want this, others do not. Choose wisely. :-) This //busybox. Some systems want this, others do not. Choose wisely. :-) This
//only has meaning when BB_FEATURE_SH_STANDALONE_SHELL is enabled. //only has meaning when BB_FEATURE_SH_STANDALONE_SHELL is enabled.
// Only relevant if BB_SH is enabled. // Only relevant if BB_SH is enabled. Off by default.
#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN //#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN
// //
// Some deeply embedded systems don't have usernames or even hostnames, // Some deeply embedded systems don't have usernames or even hostnames,
// and the default prompt can look rather hideous on them. Uncomment // and the default prompt can look rather hideous on them. Uncomment
// this option for a simpler, path-only prompt (which was the default until // this option for a simpler, path-only prompt (which was the default until
// around BusyBox-0.48): // around BusyBox-0.48). On by default.
#define BB_FEATURE_SIMPLE_PROMPT // Only relevant if BB_SH is enabled.
#define BB_FEATURE_SH_SIMPLE_PROMPT
// //
//Turn on extra fbset options //Turn on extra fbset options
//#define BB_FEATURE_FBSET_FANCY //#define BB_FEATURE_FBSET_FANCY
@ -345,96 +346,105 @@
// mere mortals so leave this stuff alone. // mere mortals so leave this stuff alone.
// //
#if defined BB_MOUNT || defined BB_UMOUNT || defined BB_DF #if defined BB_MOUNT || defined BB_UMOUNT || defined BB_DF
#ifdef BB_FEATURE_MOUNT_MTAB_SUPPORT #ifdef BB_FEATURE_MOUNT_MTAB_SUPPORT
#define BB_MTAB #define BB_MTAB
#endif #endif
#else #else
#undef BB_MTAB #undef BB_MTAB
#endif #endif
// //
#if defined BB_FEATURE_COMMAND_EDITING && defined BB_SH #if defined BB_SH
#define BB_CMDEDIT #if defined BB_FEATURE_COMMAND_EDITING
#define BB_CMDEDIT
#ifndef BB_FEATURE_USE_TERMIOS
#define BB_FEATURE_USE_TERMIOS
#endif
#else
#undef BB_FEATURE_COMMAND_EDITING
#undef BB_FEATURE_COMMAND_TAB_COMPLETION
#undef BB_FEATURE_COMMAND_USERNAME_COMPLETION
#define BB_FEATURE_SH_SIMPLE_PROMPT
#endif
#else
#undef BB_FEATURE_COMMAND_EDITING
#undef BB_FEATURE_SH_APPLETS_ALWAYS_WIN
#undef BB_FEATURE_SH_STANDALONE_SHELL
#undef BB_FEATURE_SH_SIMPLE_PROMPT
#endif #endif
// //
#ifdef BB_KILLALL #ifdef BB_KILLALL
#ifndef BB_KILL #ifndef BB_KILL
#define BB_KILL #define BB_KILL
#endif #endif
#endif #endif
// //
#ifndef BB_INIT #ifndef BB_INIT
#undef BB_LINUXRC #undef BB_LINUXRC
#undef BB_FEATURE_LINUXRC #undef BB_FEATURE_LINUXRC
#endif #endif
// //
#ifdef BB_GZIP #ifdef BB_GZIP
#ifndef BB_GUNZIP #ifndef BB_GUNZIP
#define BB_GUNZIP #define BB_GUNZIP
#endif #endif
#endif #endif
// //
#ifdef BB_DPKG #ifdef BB_DPKG
#ifndef BB_DPKG_DEB #ifndef BB_DPKG_DEB
#define BB_DPKG_DEB #define BB_DPKG_DEB
#endif #endif
#endif #endif
// //
#ifdef BB_DPKG_DEB #ifdef BB_DPKG_DEB
#ifndef BB_AR #ifndef BB_AR
#define BB_AR #define BB_AR
#endif #endif
#ifndef BB_TAR #ifndef BB_TAR
#define BB_TAR #define BB_TAR
#endif #endif
#ifndef BB_FEATURE_TAR_GZIP #ifndef BB_FEATURE_TAR_GZIP
#define BB_FEATURE_TAR_GZIP #define BB_FEATURE_TAR_GZIP
#endif #endif
#endif #endif
// //
#ifdef BB_TAR #ifdef BB_TAR
#ifdef BB_FEATURE_TAR_GZIP #ifdef BB_FEATURE_TAR_GZIP
#ifndef BB_GUNZIP #ifndef BB_GUNZIP
#define BB_GUNZIP #define BB_GUNZIP
#endif #endif
#endif #endif
#endif #endif
// //
#if defined BB_MOUNT && defined BB_FEATURE_NFSMOUNT #if defined BB_MOUNT && defined BB_FEATURE_NFSMOUNT
#define BB_NFSMOUNT #define BB_NFSMOUNT
#endif
//
#if defined BB_FEATURE_COMMAND_EDITING
#ifndef BB_FEATURE_USE_TERMIOS
#define BB_FEATURE_USE_TERMIOS
#endif
#endif #endif
// //
#if defined BB_IFCONFIG #if defined BB_IFCONFIG
#ifdef BB_FEATURE_IFCONFIG_STATUS #ifdef BB_FEATURE_IFCONFIG_STATUS
#define BB_INTERFACE #define BB_INTERFACE
#endif #endif
#else #else
#undef BB_INTERFACE #undef BB_INTERFACE
#endif #endif
// //
#if defined BB_FEATURE_AUTOWIDTH #if defined BB_FEATURE_AUTOWIDTH
#ifndef BB_FEATURE_USE_TERMIOS #ifndef BB_FEATURE_USE_TERMIOS
#define BB_FEATURE_USE_TERMIOS #define BB_FEATURE_USE_TERMIOS
#endif #endif
#endif #endif
// //
#if defined BB_INSMOD || defined BB_LSMOD #if defined BB_INSMOD || defined BB_LSMOD
#if ! defined BB_FEATURE_NEW_MODULE_INTERFACE && ! defined BB_FEATURE_OLD_MODULE_INTERFACE #if ! defined BB_FEATURE_NEW_MODULE_INTERFACE && ! defined BB_FEATURE_OLD_MODULE_INTERFACE
#define BB_FEATURE_NEW_MODULE_INTERFACE #define BB_FEATURE_NEW_MODULE_INTERFACE
#endif #endif
#endif #endif
// //
#ifdef BB_SYSLOGD #ifdef BB_SYSLOGD
#if defined BB_FEATURE_IPC_SYSLOG #if defined BB_FEATURE_IPC_SYSLOG
#define BB_LOGREAD #define BB_LOGREAD
#endif #endif
#endif #endif
// //
#if defined BB_DOS2UNIX #if defined BB_DOS2UNIX
#define BB_UNIX2DOS #define BB_UNIX2DOS
#endif #endif

View File

@ -55,7 +55,7 @@
#define BB_FEATURE_COMMAND_TAB_COMPLETION #define BB_FEATURE_COMMAND_TAB_COMPLETION
#define BB_FEATURE_COMMAND_USERNAME_COMPLETION #define BB_FEATURE_COMMAND_USERNAME_COMPLETION
#define BB_FEATURE_NONPRINTABLE_INVERSE_PUT #define BB_FEATURE_NONPRINTABLE_INVERSE_PUT
#undef BB_FEATURE_SIMPLE_PROMPT #undef BB_FEATURE_SH_SIMPLE_PROMPT
#define BB_FEATURE_CLEAN_UP #define BB_FEATURE_CLEAN_UP
#define D(x) x #define D(x) x
@ -80,7 +80,7 @@
#undef BB_FEATURE_COMMAND_USERNAME_COMPLETION #undef BB_FEATURE_COMMAND_USERNAME_COMPLETION
#endif #endif
#if defined(BB_FEATURE_COMMAND_USERNAME_COMPLETION) || !defined(BB_FEATURE_SIMPLE_PROMPT) #if defined(BB_FEATURE_COMMAND_USERNAME_COMPLETION) || !defined(BB_FEATURE_SH_SIMPLE_PROMPT)
#define BB_FEATURE_GETUSERNAME_AND_HOMEDIR #define BB_FEATURE_GETUSERNAME_AND_HOMEDIR
#endif #endif
@ -178,7 +178,7 @@ static int cursor; /* required global for signal handler */
static int len; /* --- "" - - "" - -"- --""-- --""--- */ static int len; /* --- "" - - "" - -"- --""-- --""--- */
static char *command_ps; /* --- "" - - "" - -"- --""-- --""--- */ static char *command_ps; /* --- "" - - "" - -"- --""-- --""--- */
static static
#ifdef BB_FEATURE_SIMPLE_PROMPT #ifdef BB_FEATURE_SH_SIMPLE_PROMPT
const const
#endif #endif
char *cmdedit_prompt; /* --- "" - - "" - -"- --""-- --""--- */ char *cmdedit_prompt; /* --- "" - - "" - -"- --""-- --""--- */
@ -193,7 +193,7 @@ static char *home_pwd_buf = "";
static int my_euid; static int my_euid;
#endif #endif
#ifndef BB_FEATURE_SIMPLE_PROMPT #ifndef BB_FEATURE_SH_SIMPLE_PROMPT
static char *hostname_buf = ""; static char *hostname_buf = "";
static int num_ok_lines = 1; static int num_ok_lines = 1;
#endif #endif
@ -362,7 +362,7 @@ static void put_prompt(void)
cursor = 0; cursor = 0;
} }
#ifdef BB_FEATURE_SIMPLE_PROMPT #ifdef BB_FEATURE_SH_SIMPLE_PROMPT
static void parse_prompt(const char *prmt_ptr) static void parse_prompt(const char *prmt_ptr)
{ {
cmdedit_prompt = prmt_ptr; cmdedit_prompt = prmt_ptr;
@ -1510,7 +1510,7 @@ extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
history_counter++; history_counter++;
} }
} }
#if !defined(BB_FEATURE_SIMPLE_PROMPT) #if !defined(BB_FEATURE_SH_SIMPLE_PROMPT)
num_ok_lines++; num_ok_lines++;
#endif #endif
} }
@ -1519,7 +1519,7 @@ extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
#if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION) #if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION)
input_tab(0); /* strong free */ input_tab(0); /* strong free */
#endif #endif
#if !defined(BB_FEATURE_SIMPLE_PROMPT) #if !defined(BB_FEATURE_SH_SIMPLE_PROMPT)
free(cmdedit_prompt); free(cmdedit_prompt);
#endif #endif
return; return;
@ -1551,7 +1551,7 @@ int main(int argc, char **argv)
{ {
char buff[BUFSIZ]; char buff[BUFSIZ];
char *prompt = char *prompt =
#if !defined(BB_FEATURE_SIMPLE_PROMPT) #if !defined(BB_FEATURE_SH_SIMPLE_PROMPT)
"\\[\\033[32;1m\\]\\u@\\[\\x1b[33;1m\\]\\h:\ "\\[\\033[32;1m\\]\\u@\\[\\x1b[33;1m\\]\\h:\
\\[\\033[34;1m\\]\\w\\[\\033[35;1m\\] \ \\[\\033[34;1m\\]\\w\\[\\033[35;1m\\] \
\\!\\[\\e[36;1m\\]\\$ \\[\\E[0m\\]"; \\!\\[\\e[36;1m\\]\\$ \\[\\E[0m\\]";

6
lash.c
View File

@ -440,7 +440,7 @@ static int builtin_export(struct child_prog *child)
res = putenv(v); res = putenv(v);
if (res) if (res)
fprintf(stderr, "export: %m\n"); fprintf(stderr, "export: %m\n");
#ifndef BB_FEATURE_SIMPLE_PROMPT #ifndef BB_FEATURE_SH_SIMPLE_PROMPT
if (strncmp(v, "PS1=", 4)==0) if (strncmp(v, "PS1=", 4)==0)
PS1 = getenv("PS1"); PS1 = getenv("PS1");
else if (strncmp(v, "PS2=", 4)==0) else if (strncmp(v, "PS2=", 4)==0)
@ -805,7 +805,7 @@ static void restore_redirects(int squirrel[])
static inline void cmdedit_set_initial_prompt(void) static inline void cmdedit_set_initial_prompt(void)
{ {
#ifdef BB_FEATURE_SIMPLE_PROMPT #ifdef BB_FEATURE_SH_SIMPLE_PROMPT
PS1 = NULL; PS1 = NULL;
PS2 = "> "; PS2 = "> ";
#else #else
@ -821,7 +821,7 @@ static inline void cmdedit_set_initial_prompt(void)
static inline void setup_prompt_string(char **prompt_str) static inline void setup_prompt_string(char **prompt_str)
{ {
#ifdef BB_FEATURE_SIMPLE_PROMPT #ifdef BB_FEATURE_SH_SIMPLE_PROMPT
/* Set up the prompt */ /* Set up the prompt */
if (shell_context == 0) { if (shell_context == 0) {
if (PS1) if (PS1)

6
sh.c
View File

@ -440,7 +440,7 @@ static int builtin_export(struct child_prog *child)
res = putenv(v); res = putenv(v);
if (res) if (res)
fprintf(stderr, "export: %m\n"); fprintf(stderr, "export: %m\n");
#ifndef BB_FEATURE_SIMPLE_PROMPT #ifndef BB_FEATURE_SH_SIMPLE_PROMPT
if (strncmp(v, "PS1=", 4)==0) if (strncmp(v, "PS1=", 4)==0)
PS1 = getenv("PS1"); PS1 = getenv("PS1");
else if (strncmp(v, "PS2=", 4)==0) else if (strncmp(v, "PS2=", 4)==0)
@ -805,7 +805,7 @@ static void restore_redirects(int squirrel[])
static inline void cmdedit_set_initial_prompt(void) static inline void cmdedit_set_initial_prompt(void)
{ {
#ifdef BB_FEATURE_SIMPLE_PROMPT #ifdef BB_FEATURE_SH_SIMPLE_PROMPT
PS1 = NULL; PS1 = NULL;
PS2 = "> "; PS2 = "> ";
#else #else
@ -821,7 +821,7 @@ static inline void cmdedit_set_initial_prompt(void)
static inline void setup_prompt_string(char **prompt_str) static inline void setup_prompt_string(char **prompt_str)
{ {
#ifdef BB_FEATURE_SIMPLE_PROMPT #ifdef BB_FEATURE_SH_SIMPLE_PROMPT
/* Set up the prompt */ /* Set up the prompt */
if (shell_context == 0) { if (shell_context == 0) {
if (PS1) if (PS1)

View File

@ -55,7 +55,7 @@
#define BB_FEATURE_COMMAND_TAB_COMPLETION #define BB_FEATURE_COMMAND_TAB_COMPLETION
#define BB_FEATURE_COMMAND_USERNAME_COMPLETION #define BB_FEATURE_COMMAND_USERNAME_COMPLETION
#define BB_FEATURE_NONPRINTABLE_INVERSE_PUT #define BB_FEATURE_NONPRINTABLE_INVERSE_PUT
#undef BB_FEATURE_SIMPLE_PROMPT #undef BB_FEATURE_SH_SIMPLE_PROMPT
#define BB_FEATURE_CLEAN_UP #define BB_FEATURE_CLEAN_UP
#define D(x) x #define D(x) x
@ -80,7 +80,7 @@
#undef BB_FEATURE_COMMAND_USERNAME_COMPLETION #undef BB_FEATURE_COMMAND_USERNAME_COMPLETION
#endif #endif
#if defined(BB_FEATURE_COMMAND_USERNAME_COMPLETION) || !defined(BB_FEATURE_SIMPLE_PROMPT) #if defined(BB_FEATURE_COMMAND_USERNAME_COMPLETION) || !defined(BB_FEATURE_SH_SIMPLE_PROMPT)
#define BB_FEATURE_GETUSERNAME_AND_HOMEDIR #define BB_FEATURE_GETUSERNAME_AND_HOMEDIR
#endif #endif
@ -178,7 +178,7 @@ static int cursor; /* required global for signal handler */
static int len; /* --- "" - - "" - -"- --""-- --""--- */ static int len; /* --- "" - - "" - -"- --""-- --""--- */
static char *command_ps; /* --- "" - - "" - -"- --""-- --""--- */ static char *command_ps; /* --- "" - - "" - -"- --""-- --""--- */
static static
#ifdef BB_FEATURE_SIMPLE_PROMPT #ifdef BB_FEATURE_SH_SIMPLE_PROMPT
const const
#endif #endif
char *cmdedit_prompt; /* --- "" - - "" - -"- --""-- --""--- */ char *cmdedit_prompt; /* --- "" - - "" - -"- --""-- --""--- */
@ -193,7 +193,7 @@ static char *home_pwd_buf = "";
static int my_euid; static int my_euid;
#endif #endif
#ifndef BB_FEATURE_SIMPLE_PROMPT #ifndef BB_FEATURE_SH_SIMPLE_PROMPT
static char *hostname_buf = ""; static char *hostname_buf = "";
static int num_ok_lines = 1; static int num_ok_lines = 1;
#endif #endif
@ -362,7 +362,7 @@ static void put_prompt(void)
cursor = 0; cursor = 0;
} }
#ifdef BB_FEATURE_SIMPLE_PROMPT #ifdef BB_FEATURE_SH_SIMPLE_PROMPT
static void parse_prompt(const char *prmt_ptr) static void parse_prompt(const char *prmt_ptr)
{ {
cmdedit_prompt = prmt_ptr; cmdedit_prompt = prmt_ptr;
@ -1510,7 +1510,7 @@ extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
history_counter++; history_counter++;
} }
} }
#if !defined(BB_FEATURE_SIMPLE_PROMPT) #if !defined(BB_FEATURE_SH_SIMPLE_PROMPT)
num_ok_lines++; num_ok_lines++;
#endif #endif
} }
@ -1519,7 +1519,7 @@ extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
#if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION) #if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION)
input_tab(0); /* strong free */ input_tab(0); /* strong free */
#endif #endif
#if !defined(BB_FEATURE_SIMPLE_PROMPT) #if !defined(BB_FEATURE_SH_SIMPLE_PROMPT)
free(cmdedit_prompt); free(cmdedit_prompt);
#endif #endif
return; return;
@ -1551,7 +1551,7 @@ int main(int argc, char **argv)
{ {
char buff[BUFSIZ]; char buff[BUFSIZ];
char *prompt = char *prompt =
#if !defined(BB_FEATURE_SIMPLE_PROMPT) #if !defined(BB_FEATURE_SH_SIMPLE_PROMPT)
"\\[\\033[32;1m\\]\\u@\\[\\x1b[33;1m\\]\\h:\ "\\[\\033[32;1m\\]\\u@\\[\\x1b[33;1m\\]\\h:\
\\[\\033[34;1m\\]\\w\\[\\033[35;1m\\] \ \\[\\033[34;1m\\]\\w\\[\\033[35;1m\\] \
\\!\\[\\e[36;1m\\]\\$ \\[\\E[0m\\]"; \\!\\[\\e[36;1m\\]\\$ \\[\\E[0m\\]";

View File

@ -440,7 +440,7 @@ static int builtin_export(struct child_prog *child)
res = putenv(v); res = putenv(v);
if (res) if (res)
fprintf(stderr, "export: %m\n"); fprintf(stderr, "export: %m\n");
#ifndef BB_FEATURE_SIMPLE_PROMPT #ifndef BB_FEATURE_SH_SIMPLE_PROMPT
if (strncmp(v, "PS1=", 4)==0) if (strncmp(v, "PS1=", 4)==0)
PS1 = getenv("PS1"); PS1 = getenv("PS1");
else if (strncmp(v, "PS2=", 4)==0) else if (strncmp(v, "PS2=", 4)==0)
@ -805,7 +805,7 @@ static void restore_redirects(int squirrel[])
static inline void cmdedit_set_initial_prompt(void) static inline void cmdedit_set_initial_prompt(void)
{ {
#ifdef BB_FEATURE_SIMPLE_PROMPT #ifdef BB_FEATURE_SH_SIMPLE_PROMPT
PS1 = NULL; PS1 = NULL;
PS2 = "> "; PS2 = "> ";
#else #else
@ -821,7 +821,7 @@ static inline void cmdedit_set_initial_prompt(void)
static inline void setup_prompt_string(char **prompt_str) static inline void setup_prompt_string(char **prompt_str)
{ {
#ifdef BB_FEATURE_SIMPLE_PROMPT #ifdef BB_FEATURE_SH_SIMPLE_PROMPT
/* Set up the prompt */ /* Set up the prompt */
if (shell_context == 0) { if (shell_context == 0) {
if (PS1) if (PS1)