diff options
-rw-r--r-- | meson.build | 12 | ||||
-rw-r--r-- | meson_options.txt | 1 | ||||
-rw-r--r-- | sway/ipc-server.c | 10 |
3 files changed, 14 insertions, 9 deletions
diff --git a/meson.build b/meson.build index 766bf012..c50fab17 100644 --- a/meson.build +++ b/meson.build | |||
@@ -1,6 +1,7 @@ | |||
1 | project( | 1 | project( |
2 | 'sway', | 2 | 'sway', |
3 | 'c', | 3 | 'c', |
4 | version: '1.0', | ||
4 | license: 'MIT', | 5 | license: 'MIT', |
5 | meson_version: '>=0.48.0', | 6 | meson_version: '>=0.48.0', |
6 | default_options: [ | 7 | default_options: [ |
@@ -127,17 +128,12 @@ endif | |||
127 | 128 | ||
128 | add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c') | 129 | add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c') |
129 | 130 | ||
130 | version = get_option('sway-version') | 131 | if git.found() |
131 | if version != '' | ||
132 | version = '"@0@"'.format(version) | ||
133 | else | ||
134 | if not git.found() | ||
135 | error('git is required to make the version string') | ||
136 | endif | ||
137 | |||
138 | git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']).stdout().strip() | 132 | git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']).stdout().strip() |
139 | git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']).stdout().strip() | 133 | git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']).stdout().strip() |
140 | version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash, git_branch) | 134 | version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash, git_branch) |
135 | else | ||
136 | version = '"@0@"'.format(meson.project_version()) | ||
141 | endif | 137 | endif |
142 | add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c') | 138 | add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c') |
143 | 139 | ||
diff --git a/meson_options.txt b/meson_options.txt index 04b29e17..d3667acf 100644 --- a/meson_options.txt +++ b/meson_options.txt | |||
@@ -1,4 +1,3 @@ | |||
1 | option('sway-version', type : 'string', description: 'The version string reported in `sway --version`.') | ||
2 | option('default-wallpaper', type: 'boolean', value: true, description: 'Install the default wallpaper.') | 1 | option('default-wallpaper', type: 'boolean', value: true, description: 'Install the default wallpaper.') |
3 | option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions.') | 2 | option('zsh-completions', type: 'boolean', value: true, description: 'Install zsh shell completions.') |
4 | option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions.') | 3 | option('bash-completions', type: 'boolean', value: true, description: 'Install bash shell completions.') |
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) { | |||
595 | switch (client->current_command) { | 595 | switch (client->current_command) { |
596 | case IPC_COMMAND: | 596 | case IPC_COMMAND: |
597 | { | 597 | { |
598 | char *line = strtok(buf, "\n"); | ||
599 | while (line) { | ||
600 | size_t line_length = strlen(line); | ||
601 | if (line + line_length >= buf + client->payload_length) { | ||
602 | break; | ||
603 | } | ||
604 | line[line_length] = ';'; | ||
605 | line = strtok(NULL, "\n"); | ||
606 | } | ||
607 | |||
598 | list_t *res_list = execute_command(buf, NULL, NULL); | 608 | list_t *res_list = execute_command(buf, NULL, NULL); |
599 | transaction_commit_dirty(); | 609 | transaction_commit_dirty(); |
600 | char *json = cmd_results_to_json(res_list); | 610 | char *json = cmd_results_to_json(res_list); |