aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikael Kanstrup <mikael.kanstrup@sonymobile.com>2016-12-21 10:27:17 (GMT)
committerJouni Malinen <j@w1.fi>2016-12-21 10:54:24 (GMT)
commit4f59ad0699c3dec5a215266ec78c3b9bc9525f2f (patch)
tree297c2f70266c3f1767527071582b28dc845dc140
parent62b95eb67ea186d585502f6c11b4da2512b1a718 (diff)
downloadhostap-4f59ad0699c3dec5a215266ec78c3b9bc9525f2f.zip
hostap-4f59ad0699c3dec5a215266ec78c3b9bc9525f2f.tar.gz
hostap-4f59ad0699c3dec5a215266ec78c3b9bc9525f2f.tar.bz2
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>
-rw-r--r--hostapd/hostapd_cli.c38
1 files changed, 4 insertions, 34 deletions
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
index cb43b86..afa7e23 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -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,