mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
Mac OS X: implement readline functions.
OS X has an older version of readline with some differences in the names of functions.
This commit is contained in:
@@ -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])
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user