client: Fix display of the quoted params

This commit is contained in:
Tim Kourt 2018-11-09 13:43:15 -08:00 committed by Denis Kenzior
parent 5afe4576a1
commit a7c28c4977
1 changed files with 17 additions and 2 deletions

View File

@ -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);