diff options
author | Mikael Kanstrup <mikael.kanstrup@sonymobile.com> | 2016-12-21 10:27:20 (GMT) |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2016-12-21 10:59:08 (GMT) |
commit | c04a67deb04cca17263db9e54b44fa1bd6a732d5 (patch) | |
tree | cb49faf5056e4ff3325717aec561ab64389d031c /hostapd/hostapd_cli.c | |
parent | bf4167b9d58747be34991185a28d7d85603da4e9 (diff) | |
download | hostap-c04a67deb04cca17263db9e54b44fa1bd6a732d5.zip hostap-c04a67deb04cca17263db9e54b44fa1bd6a732d5.tar.gz hostap-c04a67deb04cca17263db9e54b44fa1bd6a732d5.tar.bz2 |
hostapd_cli: Add completion for get command
Add command completion support for get command.
Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sonymobile.com>
Diffstat (limited to 'hostapd/hostapd_cli.c')
-rw-r--r-- | hostapd/hostapd_cli.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c index 6d087c2..e35bd9d 100644 --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c @@ -1100,6 +1100,31 @@ static int hostapd_cli_cmd_get(struct wpa_ctrl *ctrl, int argc, char *argv[]) } +static char ** hostapd_complete_get(const char *str, int pos) +{ + int arg = get_cmd_arg_num(str, pos); + const char *fields[] = { + "version", "tls_library", + }; + int i, num_fields = ARRAY_SIZE(fields); + + if (arg == 1) { + char **res; + + res = os_calloc(num_fields + 1, sizeof(char *)); + if (!res) + return NULL; + for (i = 0; i < num_fields; i++) { + res[i] = os_strdup(fields[i]); + if (!res[i]) + return res; + } + return res; + } + return NULL; +} + + #ifdef CONFIG_FST static int hostapd_cli_cmd_fst(struct wpa_ctrl *ctrl, int argc, char *argv[]) { @@ -1429,7 +1454,7 @@ static const struct hostapd_cli_cmd hostapd_cli_commands[] = { "= exit hostapd_cli" }, { "set", hostapd_cli_cmd_set, hostapd_complete_set, "<name> <value> = set runtime variables" }, - { "get", hostapd_cli_cmd_get, NULL, + { "get", hostapd_cli_cmd_get, hostapd_complete_get, "<name> = get runtime info" }, { "set_qos_map_set", hostapd_cli_cmd_set_qos_map_set, NULL, "<arg,arg,...> = set QoS Map set element" }, |