From 94696500ddd4c8ee51fa4df8b1d27d71a4cec810 Mon Sep 17 00:00:00 2001 From: nghiaho12 Date: Tue, 3 Nov 2015 07:44:50 -0600 Subject: [PATCH] readline: Support the case where CONFIG_READLINE_MAX_BUILTINS==0 --- system/readline/Kconfig | 2 +- system/readline/readline_common.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/system/readline/Kconfig b/system/readline/Kconfig index 7221b546d..d382a7b67 100644 --- a/system/readline/Kconfig +++ b/system/readline/Kconfig @@ -49,7 +49,7 @@ config READLINE_MAX_EXTCMDS default 64 depends on READLINE_HAVE_EXTMATCH ---help--- - This the maximum number of matching names of builtin commands that + This the maximum number of matching names of external commands that will be displayed. endif # READLINE_TABCOMPLETION diff --git a/system/readline/readline_common.c b/system/readline/readline_common.c index faf094196..47a11fae9 100644 --- a/system/readline/readline_common.c +++ b/system/readline/readline_common.c @@ -107,6 +107,7 @@ static int g_cmd_history_len = 0; #if defined(CONFIG_READLINE_TABCOMPLETION) && defined(CONFIG_BUILTIN) static int count_builtin_maches(FAR char *buf, FAR int *matches, int namelen) { +#if CONFIG_READLINE_MAX_BUILTINS > 0 FAR const char *name; int nr_matches = 0; int i; @@ -126,6 +127,10 @@ static int count_builtin_maches(FAR char *buf, FAR int *matches, int namelen) } return nr_matches; + +#else + return 0; +#endif } #endif @@ -254,6 +259,7 @@ static void tab_completion(FAR struct rl_common_s *vtbl, char *buf, */ memset(tmp_name, 0, sizeof(tmp_name)); + #ifdef CONFIG_READLINE_HAVE_EXTMATCH /* Show the possible external completions */