summaryrefslogtreecommitdiff
path: root/emma.c
diff options
context:
space:
mode:
Diffstat (limited to 'emma.c')
-rw-r--r--emma.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/emma.c b/emma.c
index f8f0932..94d3c89 100644
--- a/emma.c
+++ b/emma.c
@@ -30,6 +30,11 @@ static const char id[]="$Id$";
#include <signal.h>
#include <stdarg.h>
+#ifdef ENABLE_READLINE
+#include <readline/readline.h>
+#include <readline/history.h>
+#endif
+
#include "z80.h"
#include "expr.h"
@@ -1080,7 +1085,6 @@ static int IntCheck(Z80 *z80, Z80Val v)
int main(int argc, char *argv[])
{
const char *autoarg[2]={".","auto"};
- char buff[1024];
int f;
for(f=0;f<256;f++) memctl[f]=1;
@@ -1111,6 +1115,26 @@ int main(int argc, char *argv[])
while(!quit)
{
+#ifdef ENABLE_READLINE
+ char *line;
+
+ if ((line=readline("EMMA> ")))
+ {
+ if (line[0])
+ {
+ Run(line);
+ add_history(line);
+ free(line);
+ }
+ }
+ else
+ {
+ quit=TRUE;
+ continue;
+ }
+#else
+ char buff[1024];
+
Log("EMMA> ");
fflush(stdout);
@@ -1121,6 +1145,7 @@ int main(int argc, char *argv[])
}
Run(buff);
+#endif
}
return EXIT_SUCCESS;