diff options
author | Damien George <damien.p.george@gmail.com> | 2014-05-07 15:30:15 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-05-07 15:30:15 +0100 |
commit | c35e53436b9adb3c49a8980d018b2f8198db8077 (patch) | |
tree | 1227049154a3e1facd757eec090e851def039c35 /unix/main.c | |
parent | 1dd46fafbd11941f7aa5b3b3c1f3d63e102e85cf (diff) | |
parent | 117c46d9eb00e8ffaabc1002a4946440cb1eb5b0 (diff) |
Merge pull request #582 from dhylands/unix-input
Add input command for unix
Diffstat (limited to 'unix/main.c')
-rw-r--r-- | unix/main.c | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/unix/main.c b/unix/main.c index 5a7ea1c03..cc8081150 100644 --- a/unix/main.c +++ b/unix/main.c @@ -49,11 +49,7 @@ #include "repl.h" #include "gc.h" #include "genhdr/py-version.h" - -#if MICROPY_USE_READLINE -#include <readline/readline.h> -#include <readline/history.h> -#endif +#include "input.h" // Command line options, with their defaults bool compile_only = false; @@ -143,31 +139,6 @@ STATIC char *strjoin(const char *s1, int sep_char, const char *s2) { return s; } -STATIC char *prompt(char *p) { -#if MICROPY_USE_READLINE - char *line = readline(p); - if (line) { - add_history(line); - } -#else - static char buf[256]; - fputs(p, stdout); - char *s = fgets(buf, sizeof(buf), stdin); - if (!s) { - return NULL; - } - int l = strlen(buf); - if (buf[l - 1] == '\n') { - buf[l - 1] = 0; - } else { - l++; - } - char *line = malloc(l); - memcpy(line, buf, l); -#endif - return line; -} - STATIC void do_repl(void) { printf("Micro Python " MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE "; UNIX version\n"); |