summaryrefslogtreecommitdiffhomepage
path: root/mixutils/mixvm_command.c
diff options
context:
space:
mode:
Diffstat (limited to 'mixutils/mixvm_command.c')
-rw-r--r--mixutils/mixvm_command.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/mixutils/mixvm_command.c b/mixutils/mixvm_command.c
index 516bd68..e1c03bf 100644
--- a/mixutils/mixvm_command.c
+++ b/mixutils/mixvm_command.c
@@ -24,8 +24,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
-#include <readline/readline.h>
-#include <readline/history.h>
+
+#include <mixlib/mix.h>
+
+#ifdef HAVE_LIBREADLINE
+# include <readline/readline.h>
+# include <readline/history.h>
+#else
+ typedef int Function ();
+#endif /* HAVE_LIBREADLINE */
#include <mixlib/mix_vm.h>
#include <mixlib/mix_vm_dump.h>
@@ -70,6 +77,7 @@ static const char *mix_commands_[ALL_COMMANDS_NO_] = {NULL};
+#ifdef HAVE_LIBREADLINE
/* readline functions */
static char *
mixvm_cmd_generator_ (char *text, int state);
@@ -125,6 +133,7 @@ mixvm_cmd_generator_ (char *text, int state)
/* If no names matched, then return NULL. */
return ((char *)NULL);
}
+#endif /* HAVE_LIBREADLINE */
/* command functions */
static COMMAND *
@@ -281,8 +290,12 @@ mixvm_cmd_init (char *arg, gboolean use_emacs)
for (k = 0; k < MIX_CMD_INVALID; ++k)
mix_commands_[k + LOCAL_COMANDS_NO_] = mix_vm_command_to_string (k);
mix_commands_[ALL_COMMANDS_NO_ - 1] = NULL;
+
+#ifdef HAVE_LIBREADLINE
/* Tell the completer that we want a crack first. */
rl_attempted_completion_function = (CPPFunction *)mixvm_cmd_completion_;
+#endif /* HAVE_LIBREADLINE */
+
/* initialise the dispatcher */
dis_ = mix_vm_cmd_dispatcher_new (stdout, stderr);