From 41e10db0de243c903e28ae8f0b669ff681974e69 Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Tue, 5 Feb 2019 07:39:21 -0500 Subject: IPC_COMMAND: split on newline This splits commands given in IPC_COMMAND on newline to match i3's behavior. --- sway/ipc-server.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sway/ipc-server.c b/sway/ipc-server.c index d1920cf..eb6f159 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c @@ -595,6 +595,16 @@ void ipc_client_handle_command(struct ipc_client *client) { switch (client->current_command) { case IPC_COMMAND: { + char *line = strtok(buf, "\n"); + while (line) { + size_t line_length = strlen(line); + if (line + line_length >= buf + client->payload_length) { + break; + } + line[line_length] = ';'; + line = strtok(NULL, "\n"); + } + list_t *res_list = execute_command(buf, NULL, NULL); transaction_commit_dirty(); char *json = cmd_results_to_json(res_list); -- cgit v1.1