aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/output
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-09-13 21:55:46 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-09-13 22:21:10 -0400
commit1cf737489db68312556d0a215c17e93a573b283f (patch)
treef656d72d5db60f790112689783f0950e64b2b03a /sway/commands/output
parentAllow spaces in background file paths (diff)
downloadsway-1cf737489db68312556d0a215c17e93a573b283f.tar.gz
sway-1cf737489db68312556d0a215c17e93a573b283f.tar.zst
sway-1cf737489db68312556d0a215c17e93a573b283f.zip
Escape spaces in background file path
Diffstat (limited to 'sway/commands/output')
-rw-r--r--sway/commands/output/background.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sway/commands/output/background.c b/sway/commands/output/background.c
index 8ab52a2e..2ff5f0d7 100644
--- a/sway/commands/output/background.c
+++ b/sway/commands/output/background.c
@@ -63,6 +63,12 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
63 63
64 wordexp_t p; 64 wordexp_t p;
65 char *src = join_args(argv, j); 65 char *src = join_args(argv, j);
66 while (strstr(src, " ")) {
67 src = realloc(src, strlen(src) + 2);
68 char *ptr = strstr(src, " ") + 1;
69 memmove(ptr + 1, ptr, strlen(ptr) + 1);
70 *ptr = '\\';
71 }
66 if (wordexp(src, &p, 0) != 0 || p.we_wordv[0] == NULL) { 72 if (wordexp(src, &p, 0) != 0 || p.we_wordv[0] == NULL) {
67 struct cmd_results *cmd_res = cmd_results_new(CMD_INVALID, "output", 73 struct cmd_results *cmd_res = cmd_results_new(CMD_INVALID, "output",
68 "Invalid syntax (%s)", src); 74 "Invalid syntax (%s)", src);