summaryrefslogtreecommitdiff
path: root/includes/BReadline.h
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-07-24 09:01:28 +0200
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-07-24 09:01:28 +0200
commit316b2a40f0bd9ccdf8a2ff2f2e097011cbb5fedf (patch)
treeff14daa9091b63c38dabadcf74f128e6aa10d804 /includes/BReadline.h
parent80a6f3a91488c5a45fa0bbc93d91aeb4ebb630c5 (diff)
Implemented Readline by using libedit.
Diffstat (limited to 'includes/BReadline.h')
-rw-r--r--includes/BReadline.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/includes/BReadline.h b/includes/BReadline.h
index 6f70f09..73756c4 100644
--- a/includes/BReadline.h
+++ b/includes/BReadline.h
@@ -1 +1,24 @@
#pragma once
+
+#include <histedit.h>
+#include <BString.h>
+#include <Handle.h>
+
+class Readline {
+ public:
+ Readline(const Balau::String & program, Balau::IO<Balau::Handle>);
+ ~Readline();
+ Balau::String gets();
+ bool gotEOF() { return m_eof; }
+ void setPrompt(const Balau::String & prompt);
+ private:
+ EditLine * m_el = NULL;
+ Balau::IO<Balau::Handle> m_in;
+ bool m_eof = false;
+ Balau::String m_prompt = "> ";
+
+ static const char * elPrompt(EditLine *);
+ const char * elPrompt() { return m_prompt.to_charp(); }
+ static int elGetCFN(EditLine *, char * c);
+ int elGetCFN(char * c);
+};