commit a7c28c4977d4dd3c785e3bbb11030ca372204e47
parent 5afe4576a1d9ef1aa9f902211d6a8571a71abb87
Author: Tim Kourt <tim.a.kourt@linux.intel.com>
Date: Fri, 9 Nov 2018 13:43:15 -0800
client: Fix display of the quoted params
Diffstat:
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/client/display.c b/client/display.c
@@ -185,8 +185,23 @@ void display_refresh_set_cmd(const char *family, const char *entity,
L_AUTO_FREE_VAR(char *, args);
char *prompt;
- for (i = 0; i < argc; i++)
- l_string_append_printf(buf, "'%s' ", argv[i]);
+ for (i = 0; i < argc; i++) {
+ bool needs_quotes = false;
+ char *p = argv[i];
+
+ for (p = argv[i]; *p != '\0'; p++) {
+ if (*p != ' ')
+ continue;
+
+ needs_quotes = true;
+ break;
+ }
+
+ if (needs_quotes)
+ l_string_append_printf(buf, "\"%s\" ", argv[i]);
+ else
+ l_string_append_printf(buf, "%s ", argv[i]);
+ }
args = l_string_unwrap(buf);