diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-02-05 14:39:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-05 14:39:10 +0100 |
commit | a6363d1206784c4f28df47801f2d6fb1709587dc (patch) | |
tree | a8dccb095e9c53a413fb15764f9777a8ef1884bf | |
parent | 876bc9e44c41661664aceee3cf4585b1586afbd9 (diff) | |
parent | 288e35f99eb7ee6a6ca5ba4c14fa666a409855e3 (diff) |
Merge pull request #3573 from RedSoxFan/ipc-newlines
IPC_COMMAND: split on newline
-rw-r--r-- | sway/ipc-server.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index d1920cfd..eb6f159d 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); |