diff options
author | Denis Vlasenko | 2007-01-22 07:21:38 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-01-22 07:21:38 +0000 |
commit | 8e1c71529c2bf38a04d4a117e625e59044a0785a (patch) | |
tree | 2f115293c25e7ee9307f268ec198e2cf486ff070 /shell/hush.c | |
parent | 00cdbd8fc20a4e2e2208f90a2691a3806c931b06 (diff) | |
download | busybox-8e1c71529c2bf38a04d4a117e625e59044a0785a.zip busybox-8e1c71529c2bf38a04d4a117e625e59044a0785a.tar.gz |
Convert cmdedit into more generic line input facility
(make history and completion optional at runtime).
Use it for fdisk, as an example.
Some unrelated fixes in fdisk are also here.
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/shell/hush.c b/shell/hush.c index 8f2dc80..2c88238 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -98,7 +98,6 @@ /* #include <dmalloc.h> */ /* #define DEBUG_SHELL */ -#include "cmdedit.h" #define SPECIAL_VAR_SYMBOL 03 #define FLAG_EXIT_FROM_LOOP 1 @@ -883,20 +882,24 @@ static void setup_prompt_string(int promptmode, char **prompt_str) debug_printf("result %s\n",*prompt_str); } +#if ENABLE_FEATURE_COMMAND_EDITING +static line_input_t *line_input_state; +#endif + static void get_user_input(struct in_str *i) { char *prompt_str; static char the_command[BUFSIZ]; setup_prompt_string(i->promptmode, &prompt_str); -#ifdef CONFIG_FEATURE_COMMAND_EDITING +#if ENABLE_FEATURE_COMMAND_EDITING /* ** enable command line editing only while a command line ** is actually being read; otherwise, we'll end up bequeathing ** atexit() handlers and other unwanted stuff to our ** child processes (rob@sysgo.de) */ - cmdedit_read_input(prompt_str, the_command); + read_line_input(prompt_str, the_command, BUFSIZ, line_input_state); #else fputs(prompt_str, stdout); fflush(stdout); @@ -2647,6 +2650,10 @@ int hush_main(int argc, char **argv) FILE *input; char **e = environ; +#ifdef CONFIG_FEATURE_COMMAND_EDITING + line_input_state = new_line_input_t(FOR_SHELL); +#endif + /* XXX what should these be while sourcing /etc/profile? */ global_argc = argc; global_argv = argv; |