diff options
author | Martin Pool <mbp@samba.org> | 2001-11-19 04:18:45 +0000 |
---|---|---|
committer | Martin Pool <mbp@samba.org> | 2001-11-19 04:18:45 +0000 |
commit | b99209cce4a91de279bb62dbc4246845bf0e755d (patch) | |
tree | a895f0d26821550ab7f0b7fa65a48ed8bb84c316 /source3/lib | |
parent | 40b8b058d2b4a3c41d0bc1248c9924569118dc12 (diff) | |
download | samba-b99209cce4a91de279bb62dbc4246845bf0e755d.tar.gz samba-b99209cce4a91de279bb62dbc4246845bf0e755d.tar.xz samba-b99209cce4a91de279bb62dbc4246845bf0e755d.zip |
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)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/readline.c | 15 |
1 files changed, 10 insertions, 5 deletions
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; |