From 7629b7f51568a8cb2bedf2460cbfb1f9446769ca Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Fri, 25 Jul 2014 13:30:58 -0500 Subject: [PATCH] LU-5418: compilation fix when using newer readline lib Newer versions of readline have removed (or hidden) CPPFunction, leading to the following compilation issue: util/parser.c: In function 'init_input': util/parser.c:308:45: error: 'CPPFunction' undeclared (first use in this function) Remove all the casts in init_input and fix the involded functions instead. Also, make init_input() static, fix its declaration, and convert some spaces to tabs. Change-Id: I4896aaa01f8b8f91bd5cb81f858c759d71d52a56 Signed-off-by: frank zago Reviewed-on: http://review.whamcloud.com/11231 Reviewed-by: Dmitry Eremin Tested-by: Jenkins Reviewed-by: James Simmons Reviewed-by: Robert Read Tested-by: Maloo Reviewed-by: Oleg Drokin --- libcfs/libcfs/util/parser.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/libcfs/libcfs/util/parser.c b/libcfs/libcfs/util/parser.c index 391db19..3ac8d18 100644 --- a/libcfs/libcfs/util/parser.c +++ b/libcfs/libcfs/util/parser.c @@ -220,7 +220,7 @@ static char * command_generator(const char * text, int state) } /* probably called by readline */ -static char **command_completion(char * text, int start, int end) +static char **command_completion(const char *text, int start, int end) { command_t * table; char * pos; @@ -283,32 +283,28 @@ int execute_line(char * line) return rc; } -int -noop_fn () -{ - return (0); -} +static void noop_int_fn(int unused) { } +static void noop_void_fn(void) { } /* just in case you're ever in an airplane and discover you - forgot to install readline-dev. :) */ -int init_input() + * forgot to install readline-dev. :) */ +static int init_input(void) { - int interactive = isatty (fileno (stdin)); + int interactive = isatty(fileno(stdin)); #ifdef HAVE_LIBREADLINE - using_history(); - stifle_history(HISTORY); + using_history(); + stifle_history(HISTORY); - if (!interactive) - { - rl_prep_term_function = (rl_vintfunc_t *)noop_fn; - rl_deprep_term_function = (rl_voidfunc_t *)noop_fn; - } + if (!interactive) { + rl_prep_term_function = noop_int_fn; + rl_deprep_term_function = noop_void_fn; + } - rl_attempted_completion_function = (CPPFunction *)command_completion; - rl_completion_entry_function = (void *)command_generator; + rl_attempted_completion_function = command_completion; + rl_completion_entry_function = command_generator; #endif - return interactive; + return interactive; } #ifndef HAVE_LIBREADLINE -- 1.8.3.1