Adjusting for formatting guidelines

This commit is contained in:
John Jones 2018-03-06 09:25:38 -05:00
parent 5f3ace5ca3
commit f5d68e9336

View file

@ -119,27 +119,30 @@ void cli::run()
*/ */
static char *my_rl_complete(char *token, int *match) static char *my_rl_complete(char *token, int *match)
{ {
int matchlen = 0; int matchlen = 0;
int count = 0; int count = 0;
std::string method_name; std::string method_name;
auto& cmd = cli_commands(); auto& cmd = cli_commands();
int partlen = strlen (token); /* Part of token */ int partlen = strlen (token); /* Part of token */
for (std::string it : cmd) { for (const std::string it : cmd)
if (!strncmp ( it.c_str(), token, partlen)) { {
method_name = it; if (it.compare(0, partlen, token) == 0)
matchlen = partlen; {
count ++; method_name = it;
} matchlen = partlen;
} count ++;
}
}
if (count == 1) { if (count == 1)
*match = 1; {
method_name += " "; *match = 1;
return strdup (method_name.c_str() + matchlen); method_name += " ";
} return strdup (method_name.c_str() + matchlen);
}
return NULL; return NULL;
} }
/*** /***