diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-09-13 21:55:46 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2018-09-13 22:21:10 -0400 |
commit | 1cf737489db68312556d0a215c17e93a573b283f (patch) | |
tree | f656d72d5db60f790112689783f0950e64b2b03a | |
parent | Allow spaces in background file paths (diff) | |
download | sway-1cf737489db68312556d0a215c17e93a573b283f.tar.gz sway-1cf737489db68312556d0a215c17e93a573b283f.tar.zst sway-1cf737489db68312556d0a215c17e93a573b283f.zip |
Escape spaces in background file path
-rw-r--r-- | sway/commands/output/background.c | 6 |
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); |