aboutsummaryrefslogtreecommitdiff
path: root/shell/lash.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-01-22 07:21:38 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-01-22 07:21:38 +0000
commit8e1c71529c2bf38a04d4a117e625e59044a0785a (patch)
tree2f115293c25e7ee9307f268ec198e2cf486ff070 /shell/lash.c
parent00cdbd8fc20a4e2e2208f90a2691a3806c931b06 (diff)
downloadbusybox-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/lash.c')
-rw-r--r--shell/lash.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/shell/lash.c b/shell/lash.c
index b2ccaf0a1..a09a9a9b1 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -23,8 +23,6 @@
#include "busybox.h"
#include <getopt.h>
-#include "cmdedit.h"
-
#include <glob.h>
#define expand_t glob_t
@@ -641,6 +639,10 @@ static inline void setup_prompt_string(char **prompt_str)
#endif
}
+#if ENABLE_FEATURE_COMMAND_EDITING
+static line_input_t *line_input_state;
+#endif
+
static int get_command(FILE * source, char *command)
{
char *prompt_str;
@@ -659,14 +661,14 @@ static int get_command(FILE * source, char *command)
if (source == stdin) {
setup_prompt_string(&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, command);
+ read_line_input(prompt_str, command, BUFSIZ, line_input_state);
return 0;
#else
fputs(prompt_str, stdout);
@@ -1505,6 +1507,10 @@ int lash_main(int argc_l, char **argv_l)
argc = argc_l;
argv = argv_l;
+#if ENABLE_FEATURE_COMMAND_EDITING
+ line_input_state = new_line_input_t(FOR_SHELL);
+#endif
+
/* These variables need re-initializing when recursing */
last_jobid = 0;
close_me_list = NULL;