Add readline history support.

This commit is contained in:
Paul Sokolovsky 2014-01-01 14:54:39 +02:00
parent 83c437cb0d
commit 903b24f041
1 changed files with 2 additions and 0 deletions

View File

@ -16,6 +16,7 @@
#include "repl.h" #include "repl.h"
#include <readline/readline.h> #include <readline/readline.h>
#include <readline/history.h>
static char *str_join(const char *s1, int sep_char, const char *s2) { static char *str_join(const char *s1, int sep_char, const char *s2) {
int l1 = strlen(s1); int l1 = strlen(s1);
@ -38,6 +39,7 @@ static void do_repl(void) {
// EOF // EOF
return; return;
} }
add_history(line);
if (mp_repl_is_compound_stmt(line)) { if (mp_repl_is_compound_stmt(line)) {
for (;;) { for (;;) {
char *line2 = readline("... "); char *line2 = readline("... ");