aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wpa_cli.c
diff options
context:
space:
mode:
authorMikael Kanstrup <mikael.kanstrup@sonymobile.com>2015-03-24 16:10:39 (GMT)
committerJouni Malinen <j@w1.fi>2015-03-26 20:53:37 (GMT)
commit1ca6c0f1f1255008b9870e9bea4e648dc7c7412a (patch)
tree4a736bd671c44d5fff4a5d7f92b9ef15e1e5655d /wpa_supplicant/wpa_cli.c
parent7e6cc90805c86dfc14a73cd9e48fc1fdabd1f448 (diff)
downloadhostap-1ca6c0f1f1255008b9870e9bea4e648dc7c7412a.zip
hostap-1ca6c0f1f1255008b9870e9bea4e648dc7c7412a.tar.gz
hostap-1ca6c0f1f1255008b9870e9bea4e648dc7c7412a.tar.bz2
wpa_cli: Completion for remove, select, disable, enable network
Add command completion routines for remove_network, select_network, disable_network, and enable_network commands. Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sonymobile.com>
Diffstat (limited to 'wpa_supplicant/wpa_cli.c')
-rw-r--r--wpa_supplicant/wpa_cli.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index a161536..e0ae1ad 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -1619,6 +1619,15 @@ static char ** wpa_cli_complete_network(const char *str, int pos)
}
+static char ** wpa_cli_complete_network_id(const char *str, int pos)
+{
+ int arg = get_cmd_arg_num(str, pos);
+ if (arg == 1)
+ return cli_txt_list_array(&networks);
+ return NULL;
+}
+
+
static int wpa_cli_cmd_dup_network(struct wpa_ctrl *ctrl, int argc,
char *argv[])
{
@@ -2876,19 +2885,23 @@ static struct wpa_cli_cmd wpa_cli_commands[] = {
{ "list_networks", wpa_cli_cmd_list_networks, NULL,
cli_cmd_flag_none,
"= list configured networks" },
- { "select_network", wpa_cli_cmd_select_network, NULL,
+ { "select_network", wpa_cli_cmd_select_network,
+ wpa_cli_complete_network_id,
cli_cmd_flag_none,
"<network id> = select a network (disable others)" },
- { "enable_network", wpa_cli_cmd_enable_network, NULL,
+ { "enable_network", wpa_cli_cmd_enable_network,
+ wpa_cli_complete_network_id,
cli_cmd_flag_none,
"<network id> = enable a network" },
- { "disable_network", wpa_cli_cmd_disable_network, NULL,
+ { "disable_network", wpa_cli_cmd_disable_network,
+ wpa_cli_complete_network_id,
cli_cmd_flag_none,
"<network id> = disable a network" },
{ "add_network", wpa_cli_cmd_add_network, NULL,
cli_cmd_flag_none,
"= add a network" },
- { "remove_network", wpa_cli_cmd_remove_network, NULL,
+ { "remove_network", wpa_cli_cmd_remove_network,
+ wpa_cli_complete_network_id,
cli_cmd_flag_none,
"<network id> = remove a network" },
{ "set_network", wpa_cli_cmd_set_network, wpa_cli_complete_network,