hostapd_cli: Use common completion for commands that use stations

More than one command takes STA address as the only parameter. Make use
of a common completion routine.

Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sonymobile.com>
This commit is contained in:
Mikael Kanstrup 2016-12-21 11:27:17 +01:00 committed by Jouni Malinen
parent 62b95eb67e
commit 4f59ad0699

View file

@ -320,7 +320,7 @@ static int hostapd_cli_cmd_sta(struct wpa_ctrl *ctrl, int argc, char *argv[])
}
static char ** hostapd_complete_sta(const char *str, int pos)
static char ** hostapd_complete_stations(const char *str, int pos)
{
int arg = get_cmd_arg_num(str, pos);
char **res = NULL;
@ -367,21 +367,6 @@ static int hostapd_cli_cmd_deauthenticate(struct wpa_ctrl *ctrl, int argc,
}
static char ** hostapd_complete_deauthenticate(const char *str, int pos)
{
int arg = get_cmd_arg_num(str, pos);
char **res = NULL;
switch (arg) {
case 1:
res = cli_txt_list_array(&stations);
break;
}
return res;
}
static int hostapd_cli_cmd_disassociate(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
@ -400,21 +385,6 @@ static int hostapd_cli_cmd_disassociate(struct wpa_ctrl *ctrl, int argc,
}
static char ** hostapd_complete_disassociate(const char *str, int pos)
{
int arg = get_cmd_arg_num(str, pos);
char **res = NULL;
switch (arg) {
case 1:
res = cli_txt_list_array(&stations);
break;
}
return res;
}
#ifdef CONFIG_TAXONOMY
static int hostapd_cli_cmd_signature(struct wpa_ctrl *ctrl, int argc,
char *argv[])
@ -1347,7 +1317,7 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
"= reload/truncate debug log output file" },
{ "status", hostapd_cli_cmd_status, NULL,
"= show interface status info" },
{ "sta", hostapd_cli_cmd_sta, hostapd_complete_sta,
{ "sta", hostapd_cli_cmd_sta, hostapd_complete_stations,
"<addr> = get MIB variables for one station" },
{ "all_sta", hostapd_cli_cmd_all_sta, NULL,
"= get MIB variables for all stations" },
@ -1356,10 +1326,10 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = {
{ "new_sta", hostapd_cli_cmd_new_sta, NULL,
"<addr> = add a new station" },
{ "deauthenticate", hostapd_cli_cmd_deauthenticate,
hostapd_complete_deauthenticate,
hostapd_complete_stations,
"<addr> = deauthenticate a station" },
{ "disassociate", hostapd_cli_cmd_disassociate,
hostapd_complete_disassociate,
hostapd_complete_stations,
"<addr> = disassociate a station" },
#ifdef CONFIG_TAXONOMY
{ "signature", hostapd_cli_cmd_signature, NULL,