diff options
author | Ian Fan <ianfan0@gmail.com> | 2018-08-12 00:32:13 +0100 |
---|---|---|
committer | Ian Fan <ianfan0@gmail.com> | 2018-08-18 17:25:06 +0100 |
commit | e81cc8a5754386d9484b84cf97ab2f8755c35294 (patch) | |
tree | a3a9f64d0e179b07f94e2fff1484f5099f440432 /sway/commands/move.c | |
parent | commands: handle quoted exec command (diff) | |
download | sway-e81cc8a5754386d9484b84cf97ab2f8755c35294.tar.gz sway-e81cc8a5754386d9484b84cf97ab2f8755c35294.tar.zst sway-e81cc8a5754386d9484b84cf97ab2f8755c35294.zip |
commands: saner workspace number handling
Diffstat (limited to 'sway/commands/move.c')
-rw-r--r-- | sway/commands/move.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c index f5eb9124..33d1ee4a 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c | |||
@@ -1,4 +1,5 @@ | |||
1 | #define _XOPEN_SOURCE 500 | 1 | #define _XOPEN_SOURCE 500 |
2 | #include <ctype.h> | ||
2 | #include <stdbool.h> | 3 | #include <stdbool.h> |
3 | #include <string.h> | 4 | #include <string.h> |
4 | #include <strings.h> | 5 | #include <strings.h> |
@@ -124,7 +125,11 @@ static struct cmd_results *cmd_move_container(struct sway_container *current, | |||
124 | return cmd_results_new(CMD_INVALID, "move", | 125 | return cmd_results_new(CMD_INVALID, "move", |
125 | expected_syntax); | 126 | expected_syntax); |
126 | } | 127 | } |
127 | ws_name = strdup(argv[3]); | 128 | if (!isdigit(argv[3][0])) { |
129 | return cmd_results_new(CMD_INVALID, "move", | ||
130 | "Invalid workspace number '%s'", argv[3]); | ||
131 | } | ||
132 | ws_name = join_args(argv + 3, argc - 3); | ||
128 | ws = workspace_by_number(ws_name); | 133 | ws = workspace_by_number(ws_name); |
129 | } else { | 134 | } else { |
130 | ws_name = join_args(argv + 2, argc - 2); | 135 | ws_name = join_args(argv + 2, argc - 2); |