提交 f7deea52 编写于 作者: M Michal Privoznik

tools: Work around ancient readline

My latest commit of a7851864 uncovered a problem we fixed
in 9eb23fe2 but then reverted in 834c5720. Turns out, some
systems (I'm looking at you OS X) have ancient readline with
broken header file.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 28907b00
......@@ -2892,6 +2892,7 @@ vshReadlineInit(vshControl *ctl)
int ret = -1;
char *histsize_env = NULL;
const char *histsize_str = NULL;
const char *break_characters = " \t\n\\`@$><=;|&{(";
/* Opaque data for autocomplete callbacks. */
autoCompleteOpaque = ctl;
......@@ -2900,12 +2901,20 @@ vshReadlineInit(vshControl *ctl)
* Work around ancient readline 4.1 (hello Mac OS X),
* which declared it as 'char *' instead of 'const char *'.
*/
# if defined(RL_READLINE_VERSION) && RL_READLINE_VERSION > 0x0402
rl_readline_name = ctl->name;
# else
rl_readline_name = (char *) ctl->name;
# endif
/* Tell the completer that we want a crack first. */
rl_attempted_completion_function = vshReadlineCompletion;
rl_basic_word_break_characters = " \t\n\\`@$><=;|&{(";
# if defined(RL_READLINE_VERSION) && RL_READLINE_VERSION > 0x0402
rl_basic_word_break_characters = break_characters;
# else
rl_basic_word_break_characters = (char *) break_characters;
# endif
if (virAsprintf(&histsize_env, "%s_HISTSIZE", ctl->env_prefix) < 0)
goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册