Add command completion support for get command Signed-off-by: Mikael Kanstrup <mikael.kanstrup@xxxxxxxxxxxxxx> --- hostapd/hostapd_cli.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c index 144efad..2a3b5bd 100644 --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c @@ -1098,6 +1098,29 @@ 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 = os_calloc(num_fields + 1, sizeof(char *)); + if (res == NULL) + return NULL; + for (i = 0; i < num_fields; i++) { + res[i] = os_strdup(fields[i]); + if (res[i] == NULL) + return res; + } + return res; + } + return NULL; +} + + #ifdef CONFIG_FST static int hostapd_cli_cmd_fst(struct wpa_ctrl *ctrl, int argc, char *argv[]) { @@ -1427,7 +1450,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" }, -- 2.10.1.502.g6598894 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap