diff options
author | Tony Crisci <tony@dubstepdish.com> | 2017-12-19 05:26:55 -0500 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2017-12-19 05:26:55 -0500 |
commit | 5c036a3eac89e3dec71484fe9c22704b120254b1 (patch) | |
tree | b3996f7027c6a73059f10fe287481bf2fda45d45 /sway/commands/seat.c | |
parent | use snprintf to get identifier len (diff) | |
download | sway-5c036a3eac89e3dec71484fe9c22704b120254b1.tar.gz sway-5c036a3eac89e3dec71484fe9c22704b120254b1.tar.zst sway-5c036a3eac89e3dec71484fe9c22704b120254b1.zip |
error on not enough input/seat args for cmd
Diffstat (limited to 'sway/commands/seat.c')
-rw-r--r-- | sway/commands/seat.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/sway/commands/seat.c b/sway/commands/seat.c index 0149762a..155bc510 100644 --- a/sway/commands/seat.c +++ b/sway/commands/seat.c | |||
@@ -16,22 +16,22 @@ struct cmd_results *cmd_seat(int argc, char **argv) { | |||
16 | return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL); | 16 | return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL); |
17 | } | 17 | } |
18 | 18 | ||
19 | if (argc > 2) { | 19 | if ((error = checkarg(argc, "seat", EXPECTED_AT_LEAST, 3))) { |
20 | int argc_new = argc-2; | 20 | return error; |
21 | char **argv_new = argv+2; | ||
22 | |||
23 | struct cmd_results *res; | ||
24 | current_seat_config = new_seat_config(argv[0]); | ||
25 | if (strcasecmp("attach", argv[1]) == 0) { | ||
26 | res = seat_cmd_attach(argc_new, argv_new); | ||
27 | } else if (strcasecmp("fallback", argv[1]) == 0) { | ||
28 | res = seat_cmd_fallback(argc_new, argv_new); | ||
29 | } else { | ||
30 | res = cmd_results_new(CMD_INVALID, "seat <name>", "Unknown command %s", argv[1]); | ||
31 | } | ||
32 | current_seat_config = NULL; | ||
33 | return res; | ||
34 | } | 21 | } |
35 | 22 | ||
36 | return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL); | 23 | int argc_new = argc-2; |
24 | char **argv_new = argv+2; | ||
25 | |||
26 | struct cmd_results *res; | ||
27 | current_seat_config = new_seat_config(argv[0]); | ||
28 | if (strcasecmp("attach", argv[1]) == 0) { | ||
29 | res = seat_cmd_attach(argc_new, argv_new); | ||
30 | } else if (strcasecmp("fallback", argv[1]) == 0) { | ||
31 | res = seat_cmd_fallback(argc_new, argv_new); | ||
32 | } else { | ||
33 | res = cmd_results_new(CMD_INVALID, "seat <name>", "Unknown command %s", argv[1]); | ||
34 | } | ||
35 | current_seat_config = NULL; | ||
36 | return res; | ||
37 | } | 37 | } |