diff options
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) { return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL); } - if (argc > 2) { - int argc_new = argc-2; - char **argv_new = argv+2; - - struct cmd_results *res; - current_seat_config = new_seat_config(argv[0]); - if (strcasecmp("attach", argv[1]) == 0) { - res = seat_cmd_attach(argc_new, argv_new); - } else if (strcasecmp("fallback", argv[1]) == 0) { - res = seat_cmd_fallback(argc_new, argv_new); - } else { - res = cmd_results_new(CMD_INVALID, "seat <name>", "Unknown command %s", argv[1]); - } - current_seat_config = NULL; - return res; + if ((error = checkarg(argc, "seat", EXPECTED_AT_LEAST, 3))) { + return error; } - return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL); + int argc_new = argc-2; + char **argv_new = argv+2; + + struct cmd_results *res; + current_seat_config = new_seat_config(argv[0]); + if (strcasecmp("attach", argv[1]) == 0) { + res = seat_cmd_attach(argc_new, argv_new); + } else if (strcasecmp("fallback", argv[1]) == 0) { + res = seat_cmd_fallback(argc_new, argv_new); + } else { + res = cmd_results_new(CMD_INVALID, "seat <name>", "Unknown command %s", argv[1]); + } + current_seat_config = NULL; + return res; } |