readline: Support the case where CONFIG_READLINE_MAX_BUILTINS==0

This commit is contained in:
nghiaho12 2015-11-03 07:44:50 -06:00 committed by Gregory Nutt
parent 273a083d20
commit 94696500dd
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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 */