Skip to content

Instantly share code, notes, and snippets.

@PaulOstazeski
Forked from mislav/readline.patch
Last active June 6, 2016 08:02
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save PaulOstazeski/629d82d490d15d96bc61 to your computer and use it in GitHub Desktop.
Save PaulOstazeski/629d82d490d15d96bc61 to your computer and use it in GitHub Desktop.
index 0b121c1..b327e6c 100644
--- a/ext/readline/extconf.rb
+++ b/ext/readline/extconf.rb
@@ -19,6 +19,10 @@ def readline.have_func(func)
return super(func, headers)
end
+def readline.have_type(type)
+ return super(type, headers)
+end
+
dir_config('curses')
dir_config('ncurses')
dir_config('termcap')
@@ -94,4 +98,10 @@ readline.have_func("clear_history")
readline.have_func("rl_redisplay")
readline.have_func("rl_insert_text")
readline.have_func("rl_delete_text")
+unless readline.have_type("r1_hook_func_t")
+ # rl_hook_func_t is available since readline-4.2 (2001).
+ # Function is removed at readline-6.3 (2014).
+ # However, editline (NetBSD 6.1.3, 2014) doesn't have rl_hook_func_t.
+ $DEFS << "-Dr1_hook_func_t=Function"
+end
create_makefile("readline")
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 659adb9..aba3d64 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -1974,7 +1974,7 @@ Init_readline()
rl_attempted_completion_function = readline_attempted_completion_function;
#if defined(HAVE_RL_PRE_INPUT_HOOK)
- rl_pre_input_hook = (Function *)readline_pre_input_hook;
+ rl_pre_input_hook = (r1_hook_func_t *)readline_pre_input_hook;
#endif
#ifdef HAVE_RL_CATCH_SIGNALS
rl_catch_signals = 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment