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.
diff --git a/shell/msh.c b/shell/msh.c
index c88308f..8746e42 100644
--- a/shell/msh.c
+++ b/shell/msh.c
@@ -17,7 +17,6 @@
 #include <setjmp.h>
 #include <sys/times.h>
 
-#include "cmdedit.h"
 
 /*#define MSHDEBUG 1*/
 
@@ -777,7 +776,7 @@
 #endif							/* MSHDEBUG */
 
 
-#ifdef CONFIG_FEATURE_COMMAND_EDITING
+#if ENABLE_FEATURE_COMMAND_EDITING
 static char *current_prompt;
 #endif
 
@@ -787,6 +786,10 @@
  */
 
 
+#if ENABLE_FEATURE_COMMAND_EDITING
+static line_input_t *line_input_state;
+#endif
+
 int msh_main(int argc, char **argv)
 {
 	int f;
@@ -795,6 +798,10 @@
 	char *name, **ap;
 	int (*iof) (struct ioarg *);
 
+#if ENABLE_FEATURE_COMMAND_EDITING
+	line_input_state = new_line_input_t(FOR_SHELL);
+#endif
+
 	DBGPRINTF(("MSH_MAIN: argc %d, environ %p\n", argc, environ));
 
 	initarea();
@@ -964,7 +971,7 @@
 
 	for (;;) {
 		if (interactive && e.iop <= iostack) {
-#ifdef CONFIG_FEATURE_COMMAND_EDITING
+#if ENABLE_FEATURE_COMMAND_EDITING
 			current_prompt = prompt->value;
 #else
 			prs(prompt->value);
@@ -2371,7 +2378,7 @@
 		startl = 1;
 		if (multiline || cf & CONTIN) {
 			if (interactive && e.iop <= iostack) {
-#ifdef CONFIG_FEATURE_COMMAND_EDITING
+#if ENABLE_FEATURE_COMMAND_EDITING
 				current_prompt = cprompt->value;
 #else
 				prs(cprompt->value);
@@ -2432,7 +2439,7 @@
 			return YYERRCODE;
 		}
 		if (interactive && c == '\n' && e.iop <= iostack) {
-#ifdef CONFIG_FEATURE_COMMAND_EDITING
+#if ENABLE_FEATURE_COMMAND_EDITING
 			current_prompt = cprompt->value;
 #else
 			prs(cprompt->value);
@@ -4666,7 +4673,7 @@
 					return e.iop->prev = 0;
 				}
 				if (interactive && e.iop == iostack + 1) {
-#ifdef CONFIG_FEATURE_COMMAND_EDITING
+#if ENABLE_FEATURE_COMMAND_EDITING
 					current_prompt = prompt->value;
 #else
 					prs(prompt->value);
@@ -4898,13 +4905,13 @@
 		ap->afpos++;
 		return *bp->bufp++ & 0177;
 	}
-#ifdef CONFIG_FEATURE_COMMAND_EDITING
+#if ENABLE_FEATURE_COMMAND_EDITING
 	if (interactive && isatty(ap->afile)) {
 		static char mycommand[BUFSIZ];
 		static int position = 0, size = 0;
 
 		while (size == 0 || position >= size) {
-			cmdedit_read_input(current_prompt, mycommand);
+			read_line_input(current_prompt, mycommand, BUFSIZ, line_input_state);
 			size = strlen(mycommand);
 			position = 0;
 		}
@@ -4913,7 +4920,6 @@
 		return c;
 	} else
 #endif
-
 	{
 		i = safe_read(ap->afile, &c, sizeof(c));
 		return i == sizeof(c) ? (c & 0x7f) : (closef(ap->afile), 0);
@@ -5150,7 +5156,7 @@
 		e.iobase = e.iop;
 		for (;;) {
 			if (interactive && e.iop <= iostack) {
-#ifdef CONFIG_FEATURE_COMMAND_EDITING
+#if ENABLE_FEATURE_COMMAND_EDITING
 				current_prompt = cprompt->value;
 #else
 				prs(cprompt->value);