summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------Balau0
m---------Dalos-modules0
-rw-r--r--Makefile2
-rw-r--r--src/Dalos-cli.cc19
4 files changed, 7 insertions, 14 deletions
diff --git a/Balau b/Balau
-Subproject 71b4710c4834d747e44451bd7806c5ac4effbcc
+Subproject e37ef65aaa42e790a741c15dbae9b83e9c04cd3
diff --git a/Dalos-modules b/Dalos-modules
-Subproject 80a6f3a91488c5a45fa0bbc93d91aeb4ebb630c
+Subproject 316b2a40f0bd9ccdf8a2ff2f2e097011cbb5fed
diff --git a/Makefile b/Makefile
index 6e59563..26364af 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ LDFLAGS += -g
endif
INCLUDES = includes Balau/includes Balau/libcoro Balau/libeio Balau/libev Balau/LuaJIT/src Dalos-modules/includes
-LIBS = z readline
+LIBS = z edit
ifeq ($(SYSTEM),Darwin)
LIBS += pthread iconv
diff --git a/src/Dalos-cli.cc b/src/Dalos-cli.cc
index fedec88..89069bf 100644
--- a/src/Dalos-cli.cc
+++ b/src/Dalos-cli.cc
@@ -1,10 +1,10 @@
#include <getopt.h>
-#include <readline/readline.h>
-#include <readline/history.h>
#include <Main.h>
#include <TaskMan.h>
#include <LuaTask.h>
#include <Input.h>
+#include <BStdIO.h>
+#include "BReadline.h"
using namespace Balau;
@@ -92,24 +92,17 @@ void MainTask::Do() {
if (!interactive)
return;
- char prompt[3] = "> ", * line_read = NULL;
+ String line_read;
+ Readline rl("Dalos-cli", new StdIN());
for (;;) {
- if (line_read)
- free(line_read);
+ line_read = rl.gets();
- line_read = readline(prompt);
-
- if (!line_read) {
+ if (rl.gotEOF()) {
Printer::print("\n");
break;
}
- if (!*line_read)
- continue;
-
- add_history(line_read);
-
LuaExecString luaExecString(line_read);
luaExecString.exec(luaMainTask);
}