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 | b792c9317ab62fe407de34ed811cc883a7652cc4 (patch) | |
tree | 9fde575185f34fb07d03862eaa8af4f9ccfcc6eb /source/lib/readline.c | |
parent | 4b7c0c9928f649887edc4aac093cb0cfbf51ef4a (diff) | |
download | samba-b792c9317ab62fe407de34ed811cc883a7652cc4.tar.gz samba-b792c9317ab62fe407de34ed811cc883a7652cc4.tar.xz samba-b792c9317ab62fe407de34ed811cc883a7652cc4.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.
Diffstat (limited to 'source/lib/readline.c')
-rw-r--r-- | source/lib/readline.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source/lib/readline.c b/source/lib/readline.c index fa2be0e16bd..1b81c68d032 100644 --- a/source/lib/readline.c +++ b/source/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; |