diff options
Diffstat (limited to 'sway/commands/output/position.c')
-rw-r--r-- | sway/commands/output/position.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/sway/commands/output/position.c b/sway/commands/output/position.c index 449767b1..689462cb 100644 --- a/sway/commands/output/position.c +++ b/sway/commands/output/position.c | |||
@@ -4,11 +4,10 @@ | |||
4 | 4 | ||
5 | struct cmd_results *output_cmd_position(int argc, char **argv) { | 5 | struct cmd_results *output_cmd_position(int argc, char **argv) { |
6 | if (!config->handler_context.output_config) { | 6 | if (!config->handler_context.output_config) { |
7 | return cmd_results_new(CMD_FAILURE, "output", "Missing output config"); | 7 | return cmd_results_new(CMD_FAILURE, "Missing output config"); |
8 | } | 8 | } |
9 | if (!argc) { | 9 | if (!argc) { |
10 | return cmd_results_new(CMD_INVALID, "output", | 10 | return cmd_results_new(CMD_INVALID, "Missing position argument."); |
11 | "Missing position argument."); | ||
12 | } | 11 | } |
13 | 12 | ||
14 | char *end; | 13 | char *end; |
@@ -16,26 +15,22 @@ struct cmd_results *output_cmd_position(int argc, char **argv) { | |||
16 | if (*end) { | 15 | if (*end) { |
17 | // Format is 1234,4321 | 16 | // Format is 1234,4321 |
18 | if (*end != ',') { | 17 | if (*end != ',') { |
19 | return cmd_results_new(CMD_INVALID, "output", | 18 | return cmd_results_new(CMD_INVALID, "Invalid position x."); |
20 | "Invalid position x."); | ||
21 | } | 19 | } |
22 | ++end; | 20 | ++end; |
23 | config->handler_context.output_config->y = strtol(end, &end, 10); | 21 | config->handler_context.output_config->y = strtol(end, &end, 10); |
24 | if (*end) { | 22 | if (*end) { |
25 | return cmd_results_new(CMD_INVALID, "output", | 23 | return cmd_results_new(CMD_INVALID, "Invalid position y."); |
26 | "Invalid position y."); | ||
27 | } | 24 | } |
28 | } else { | 25 | } else { |
29 | // Format is 1234 4321 (legacy) | 26 | // Format is 1234 4321 (legacy) |
30 | argc--; argv++; | 27 | argc--; argv++; |
31 | if (!argc) { | 28 | if (!argc) { |
32 | return cmd_results_new(CMD_INVALID, "output", | 29 | return cmd_results_new(CMD_INVALID, "Missing position argument (y)."); |
33 | "Missing position argument (y)."); | ||
34 | } | 30 | } |
35 | config->handler_context.output_config->y = strtol(*argv, &end, 10); | 31 | config->handler_context.output_config->y = strtol(*argv, &end, 10); |
36 | if (*end) { | 32 | if (*end) { |
37 | return cmd_results_new(CMD_INVALID, "output", | 33 | return cmd_results_new(CMD_INVALID, "Invalid position y."); |
38 | "Invalid position y."); | ||
39 | } | 34 | } |
40 | } | 35 | } |
41 | 36 | ||