commit 34800bfa63214dac0bc20f51fd1748c49eb18fb6
parent 9736bc211c8abccc98cf900a127e3faa0a231006
Author: Tim Kourt <tim.a.kourt@linux.intel.com>
Date: Tue, 23 Jul 2019 16:21:35 -0700
client: Enable word completion for the SSIDs with spaces
"I--> results in "IWD 1"
Diffstat:
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c
@@ -2,7 +2,7 @@
*
* Wireless daemon for Linux
*
- * Copyright (C) 2017 Intel Corporation. All rights reserved.
+ * Copyright (C) 2017-2019 Intel Corporation. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -140,6 +140,20 @@ static void interface_update_properties(struct proxy_interface *proxy,
proxy_interface_property_update(proxy, name, NULL);
}
+static char *strdup_quoted_for_spaces(const char *str)
+{
+ const char *p;
+
+ for (p = str; *p; p++) {
+ if (*p != ' ')
+ continue;
+
+ return l_strdup_printf("\"%s\"", str);
+ }
+
+ return l_strdup(str);
+}
+
char *proxy_property_str_completion(const struct proxy_interface_type *type,
proxy_property_match_func_t function,
const char *property_name,
@@ -177,7 +191,7 @@ char *proxy_property_str_completion(const struct proxy_interface_type *type,
if (!str)
goto done;
- return l_strdup(str);
+ return strdup_quoted_for_spaces(str);
}
done:
l_queue_destroy(match, NULL);
diff --git a/client/display.c b/client/display.c
@@ -605,6 +605,7 @@ void display_init(void)
rl_attempted_completion_function = command_completion;
rl_completion_display_matches_hook = display_completion_matches;
+ rl_completer_quote_characters = "\"";
rl_erase_empty_line = 1;
rl_callback_handler_install("Waiting for IWD to appear...",
readline_callback);