3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

client: add completion for the cmds without entity

This commit is contained in:
Tim Kourt 2017-05-12 14:36:50 -07:00 committed by Denis Kenzior
parent 8eaeb66220
commit b530f4fb77

View File

@ -199,6 +199,30 @@ static const struct command wsc_commands[] = {
static char *family_arg_completion(const char *text, int state)
{
static bool first_pass;
static size_t index;
static size_t len;
const char *cmd;
if (!state) {
index = 0;
len = strlen(text);
first_pass = true;
}
while ((cmd = wsc_commands[index].cmd)) {
if (wsc_commands[index++].entity)
continue;
if (!strncmp(cmd, text, len))
return l_strdup(cmd);
}
if (first_pass) {
state = 0;
first_pass = false;
}
return device_wsc_family_arg_completion(text, state);
}