From f9f3a2d7904548ebe1ecb06aff063a93123ec589 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 11 Oct 2006 13:59:03 +0000 Subject: [PATCH] r19246: merge from samba4 rev 18207 and 18208: readline fixes for mac os 10 metze (This used to be commit 976b97ecbf9bde400a6f92cad9d9709d56e73058) --- source3/configure.in | 7 +++++++ source3/lib/readline.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/source3/configure.in b/source3/configure.in index 9bc71058fcd..314582c4496 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -1183,6 +1183,13 @@ AC_CHECK_LIB(readline, rl_completion_matches, [], [$TERMLIBS]) +# not all readline libs have rl_event_hook or history_list +AC_CHECK_DECLS(rl_event_hook, [], [], [#include ]) +AC_CHECK_LIB(readline, history_list, + [AC_DEFINE(HAVE_HISTORY_LIST, 1, [Do we have history_list?])], + [], + [$TERMLIBS]) + # The following test taken from the cvs sources # If we can't find connect, try looking in -lsocket, -lnsl, and -linet. # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has diff --git a/source3/lib/readline.c b/source3/lib/readline.c index 1f599dc0a7f..24d16ea34fb 100644 --- a/source3/lib/readline.c +++ b/source3/lib/readline.c @@ -113,8 +113,10 @@ char *smb_readline(const char *prompt, void (*callback)(void), rl_attempted_completion_function = RL_COMPLETION_CAST completion_fn; } +#if HAVE_DECL_RL_EVENT_HOOK if (callback) rl_event_hook = (Function *)callback; +#endif ret = readline(prompt); if (ret && *ret) add_history(ret); @@ -154,7 +156,7 @@ history ****************************************************************************/ int cmd_history(void) { -#if defined(HAVE_LIBREADLINE) +#if defined(HAVE_LIBREADLINE) && defined(HAVE_HISTORY_LIST) HIST_ENTRY **hlist; int i; -- 2.11.4.GIT