diff options
Diffstat (limited to 'mixutils/mixvm_loop.c')
-rw-r--r-- | mixutils/mixvm_loop.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/mixutils/mixvm_loop.c b/mixutils/mixvm_loop.c index 8a571d8..a565832 100644 --- a/mixutils/mixvm_loop.c +++ b/mixutils/mixvm_loop.c @@ -20,13 +20,33 @@ */ +#define _GNU_SOURCE 1 +#include <stdio.h> #include <mixlib/mix.h> -#include <stdio.h> -#include <readline/readline.h> -#include <readline/history.h> #include "mixvm_command.h" +#ifdef HAVE_LIBHISTORY +# include <readline/history.h> +#else +# define add_history(x) ((void)0) +#endif + +#ifdef HAVE_LIBREADLINE +# include <readline/readline.h> +#else /* !HAVE_LIBREADLINE */ +static char * +readline (char *prompt) +{ + char *line = NULL; + size_t s = 0; + + printf ("%s", prompt); + getline (&line, &s, stdin); + return line; +} +#endif /* HAVE_LIBREADLINE */ + /* A static variable for holding the line. */ static char *line_read = (char *)NULL; static const char *PROMPT = N_("MIX > "); |