From b99209cce4a91de279bb62dbc4246845bf0e755d Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Mon, 19 Nov 2001 04:18:45 +0000 Subject: Detect libreadline>=4.0, and set HAVE_NEW_LIBREADLINE. At the moment this is only to get the cast right, but it might help with other parts of the API that changed later. (This used to be commit b792c9317ab62fe407de34ed811cc883a7652cc4) --- source3/lib/readline.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'source3/lib/readline.c') diff --git a/source3/lib/readline.c b/source3/lib/readline.c index fa2be0e16b..1b81c68d03 100644 --- a/source3/lib/readline.c +++ b/source3/lib/readline.c @@ -22,6 +22,13 @@ #include "includes.h" +#ifdef HAVE_NEW_LIBREADLINE +# define RL_COMPLETION_CAST (rl_completion_func_t *) +#else +/* This type is missing from libreadline<4.0 (approximately) */ +# define RL_COMPLETION_FUNC_T +#endif /* HAVE_NEW_LIBREADLINE */ + /**************************************************************************** display the prompt and wait for input. Call callback() regularly @@ -76,11 +83,9 @@ char *smb_readline(char *prompt, void (*callback)(void), /* The callback prototype has changed slightly between different versions of Readline, so the same function works in all of them to date, but we get compiler - warnings in some. NOTE: that not all versions of - readline have rl_completion_func_t so attempting to cast - the statement below to get rid of the warning will not - compile for everyone. */ - rl_attempted_completion_function = completion_fn; + warnings in some. */ + rl_attempted_completion_function = RL_COMPLETION_CAST + completion_fn; } if (callback) rl_event_hook = (Function *)callback; -- cgit