wpa_cli: Fix tab completion

Commit b49039bda9 redesigned tab
completion, but added the new call to completion functions into wrong
location. This needs to be done within the loop to find the correct
completion function.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2012-08-28 17:25:09 +03:00 committed by Jouni Malinen
parent 4d5bda5fca
commit e4f6873cce

View file

@ -2627,9 +2627,10 @@ static char ** wpa_cli_cmd_completion(const char *cmd, const char *str,
int i; int i;
for (i = 0; wpa_cli_commands[i].cmd; i++) { for (i = 0; wpa_cli_commands[i].cmd; i++) {
if (wpa_cli_commands[i].completion)
return wpa_cli_commands[i].completion(str, pos);
if (os_strcasecmp(wpa_cli_commands[i].cmd, cmd) == 0) { if (os_strcasecmp(wpa_cli_commands[i].cmd, cmd) == 0) {
if (wpa_cli_commands[i].completion)
return wpa_cli_commands[i].completion(str,
pos);
edit_clear_line(); edit_clear_line();
printf("\r%s\n", wpa_cli_commands[i].usage); printf("\r%s\n", wpa_cli_commands[i].usage);
edit_redraw(); edit_redraw();