summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-09-04 13:47:12 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-09-04 13:47:12 +0200
commitcd0e606efe969d8361fd38b4ca959183feeddc9b (patch)
tree708fd6bc11897513c46a773442d9fa5d24442c5b /src
parent1eb9f4df776adc5dc5cf74a587288199bbf8b703 (diff)
downloadmad-cd0e606efe969d8361fd38b4ca959183feeddc9b.tar
mad-cd0e606efe969d8361fd38b4ca959183feeddc9b.zip
Don't use GNU readline
Diffstat (limited to 'src')
-rw-r--r--src/Common/XmlData.cpp2
-rw-r--r--src/Common/XmlData.h2
-rw-r--r--src/madc.cpp30
-rw-r--r--src/modules/CMakeLists.txt8
4 files changed, 26 insertions, 16 deletions
diff --git a/src/Common/XmlData.cpp b/src/Common/XmlData.cpp
index d3c948b..4d1da6e 100644
--- a/src/Common/XmlData.cpp
+++ b/src/Common/XmlData.cpp
@@ -22,8 +22,6 @@
#include <cstdlib>
#include <cstring>
-#include <iostream>
-
namespace Mad {
namespace Common {
diff --git a/src/Common/XmlData.h b/src/Common/XmlData.h
index 216b0f1..6be2b1d 100644
--- a/src/Common/XmlData.h
+++ b/src/Common/XmlData.h
@@ -37,8 +37,6 @@
#include <boost/variant/variant.hpp>
#include <boost/smart_ptr.hpp>
-#include <iostream>
-
namespace Mad {
namespace Common {
diff --git a/src/madc.cpp b/src/madc.cpp
index 1017912..fc95266 100644
--- a/src/madc.cpp
+++ b/src/madc.cpp
@@ -36,14 +36,10 @@
#include <boost/regex.hpp>
+#include <cstdio>
#include <iostream>
-#ifdef EDITLINE_FOUND
-# include <editline/readline.h>
-#else
-# include <readline/readline.h>
-# include <readline/history.h>
-#endif
+#include <histedit.h>
using namespace Mad;
@@ -53,6 +49,10 @@ static void usage(const std::string &cmd) {
std::cerr << "Usage: " << cmd << " [host[:port]]" << std::endl;
}
+static char* prompt(EditLine* /*e*/) {
+ return const_cast<char*>("mad> ");
+}
+
int main(int argc, char *argv[]) {
if(argc > 2) {
usage(argv[0]);
@@ -125,19 +125,33 @@ int main(int argc, char *argv[]) {
Client::CommandParser commandParser(&application, connection);
+ EditLine *el = el_init(argv[0], stdin, stdout, stderr);
+
+ el_set(el, EL_EDITOR, "emacs");
+ el_set(el, EL_PROMPT, &prompt);
+
+ HistEvent histEv;
+ History *hist = history_init();
+ history(hist, &histEv, H_SETSIZE, 800);
+
+ el_set(el, EL_HIST, history, hist);
+
while(connection->isConnected() && !commandParser.willDisconnect()) {
- char *cmd = readline("mad> ");
+ const char *cmd = el_gets(el, 0);
if(!cmd) {
commandParser.requestDisconnect();
}
else if(*cmd) {
commandParser.parse(cmd);
- add_history(cmd);
+ history(hist, &histEv, H_ENTER, cmd);
}
else continue;
}
+ history_end(hist);
+ el_end(el);
+
connection->waitWhileConnected();
application.getUserManager()->unregisterBackend(networkUserBackend);
diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt
index e87d6af..b09fff3 100644
--- a/src/modules/CMakeLists.txt
+++ b/src/modules/CMakeLists.txt
@@ -44,14 +44,14 @@ add_subdirectory(SystemBackendProc)
add_subdirectory(UserConfigBackendHome)
endif(UNIX)
-if(MYSQL_FOUND)
-add_subdirectory(UserDBBackendMysql)
-endif(MYSQL_FOUND)
-
if(KRB5_FOUND)
add_subdirectory(UserConfigBackendKrb5)
endif(KRB5_FOUND)
+if(MYSQL_FOUND)
+add_subdirectory(UserDBBackendMysql)
+endif(MYSQL_FOUND)
+
SET(STATIC_MODULE_LOADERS "")
SET(STATIC_MODULE_LIST "")