diff options
author | Richard Jones <rich@koneko.home.annexia.org> | 2010-03-21 19:15:40 +0000 |
---|---|---|
committer | Richard Jones <rich@koneko.home.annexia.org> | 2010-03-22 10:41:45 +0000 |
commit | dd12eaefb5879255be78f8233f7e503ffbf7c4f1 (patch) | |
tree | dddcd362cba51429896b41580658750bbe299752 | |
parent | 5ebf3a39340696fea0582a58074d22d11247a6e7 (diff) | |
download | libguestfs-dd12eaefb5879255be78f8233f7e503ffbf7c4f1.tar.gz libguestfs-dd12eaefb5879255be78f8233f7e503ffbf7c4f1.tar.xz libguestfs-dd12eaefb5879255be78f8233f7e503ffbf7c4f1.zip |
Mac OS X: implement readline functions.
OS X has an older version of readline with some differences
in the names of functions.
-rw-r--r-- | configure.ac | 7 | ||||
-rw-r--r-- | fish/fish.c | 4 | ||||
-rwxr-xr-x | src/generator.ml | 15 |
3 files changed, 22 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index cfad704f..086b00c8 100644 --- a/configure.ac +++ b/configure.ac @@ -440,7 +440,12 @@ AS_IF([test "x$with_readline" != xno], AC_MSG_FAILURE( [--with-readline was given, but test for readline failed]) fi - ], -lncurses)]) + ], -lncurses) + old_LIBS="$LIBS" + LIBS="$LIBS $LIBREADLINE" + AC_CHECK_FUNCS([append_history completion_matches rl_completion_matches]) + LIBS="$old_LIBS" + ]) dnl For i18n. AM_GNU_GETTEXT([external]) diff --git a/fish/fish.c b/fish/fish.c index 32d6f9f1..2411f721 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -1304,7 +1304,11 @@ cleanup_readline (void) } close (fd); +#ifdef HAVE_APPEND_HISTORY (void) append_history (nr_history_lines, histfile); +#else + (void) write_history (histfile); +#endif } #endif } diff --git a/src/generator.ml b/src/generator.ml index ba883ea7..551b6bc6 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -7459,7 +7459,16 @@ generator (const char *text, int state) #endif /* HAVE_LIBREADLINE */ -char **do_completion (const char *text, int start, int end) +#ifdef HAVE_RL_COMPLETION_MATCHES +#define RL_COMPLETION_MATCHES rl_completion_matches +#else +#ifdef HAVE_COMPLETION_MATCHES +#define RL_COMPLETION_MATCHES completion_matches +#endif +#endif /* else just fail if we don't have either symbol */ + +char ** +do_completion (const char *text, int start, int end) { char **matches = NULL; @@ -7467,9 +7476,9 @@ char **do_completion (const char *text, int start, int end) rl_completion_append_character = ' '; if (start == 0) - matches = rl_completion_matches (text, generator); + matches = RL_COMPLETION_MATCHES (text, generator); else if (complete_dest_paths) - matches = rl_completion_matches (text, complete_dest_paths_generator); + matches = RL_COMPLETION_MATCHES (text, complete_dest_paths_generator); #endif return matches; |