cli: Fix for rl_startup_hook function signatures mismatch (-lreadline vs -ledit)
The rl_startup_hook function has different prototype in libreadline and in the libedit. To fix this issue, arguments of hook function has been wrapped to C preprocessor macro and properly adjusted.
This commit is contained in:

committed by
Thomas Haller

parent
8ea9da85b3
commit
f47d55fc66
@@ -53,8 +53,7 @@ usage_agent_all(void)
|
|||||||
|
|
||||||
/* for pre-filling a string to readline prompt */
|
/* for pre-filling a string to readline prompt */
|
||||||
static char *pre_input_deftext;
|
static char *pre_input_deftext;
|
||||||
static int
|
static int set_deftext(_NMC_RL_STARTUPHOOK_ARGS)
|
||||||
set_deftext(void)
|
|
||||||
{
|
{
|
||||||
if (pre_input_deftext && rl_startup_hook) {
|
if (pre_input_deftext && rl_startup_hook) {
|
||||||
rl_insert_text(pre_input_deftext);
|
rl_insert_text(pre_input_deftext);
|
||||||
|
@@ -1136,8 +1136,7 @@ nmc_rl_gen_func_ifnames(const char *text, int state)
|
|||||||
/* for pre-filling a string to readline prompt */
|
/* for pre-filling a string to readline prompt */
|
||||||
char *nmc_rl_pre_input_deftext;
|
char *nmc_rl_pre_input_deftext;
|
||||||
|
|
||||||
int
|
int nmc_rl_set_deftext(_NMC_RL_STARTUPHOOK_ARGS)
|
||||||
nmc_rl_set_deftext(void)
|
|
||||||
{
|
{
|
||||||
if (nmc_rl_pre_input_deftext && rl_startup_hook) {
|
if (nmc_rl_pre_input_deftext && rl_startup_hook) {
|
||||||
rl_insert_text(nmc_rl_pre_input_deftext);
|
rl_insert_text(nmc_rl_pre_input_deftext);
|
||||||
|
@@ -50,9 +50,17 @@ char * nmc_rl_gen_func_ifnames(const char *text, int state);
|
|||||||
gboolean nmc_get_in_readline(void);
|
gboolean nmc_get_in_readline(void);
|
||||||
void nmc_set_in_readline(gboolean in_readline);
|
void nmc_set_in_readline(gboolean in_readline);
|
||||||
|
|
||||||
|
#if HAVE_EDITLINE_READLINE
|
||||||
|
/* libedit has different signature for rl_startup_hook function */
|
||||||
|
#define _NMC_RL_STARTUPHOOK_ARGS const char *c, int i
|
||||||
|
#else
|
||||||
|
/* By default the libreadline shall be used */
|
||||||
|
#define _NMC_RL_STARTUPHOOK_ARGS void
|
||||||
|
#endif
|
||||||
|
|
||||||
/* for pre-filling a string to readline prompt */
|
/* for pre-filling a string to readline prompt */
|
||||||
extern char *nmc_rl_pre_input_deftext;
|
extern char *nmc_rl_pre_input_deftext;
|
||||||
int nmc_rl_set_deftext(void);
|
int nmc_rl_set_deftext(_NMC_RL_STARTUPHOOK_ARGS);
|
||||||
|
|
||||||
char *nmc_parse_lldp_capabilities(guint value);
|
char *nmc_parse_lldp_capabilities(guint value);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user