error on not enough input/seat args for cmd

This commit is contained in:
Tony Crisci 2017-12-19 05:26:55 -05:00
parent 730af5e721
commit 5c036a3eac
2 changed files with 60 additions and 60 deletions

View file

@ -16,7 +16,10 @@ struct cmd_results *cmd_input(int argc, char **argv) {
return cmd_results_new(CMD_BLOCK_INPUT, NULL, NULL); return cmd_results_new(CMD_BLOCK_INPUT, NULL, NULL);
} }
if (argc > 2) { if ((error = checkarg(argc, "input", EXPECTED_AT_LEAST, 3))) {
return error;
}
int argc_new = argc-2; int argc_new = argc-2;
char **argv_new = argv+2; char **argv_new = argv+2;
@ -60,6 +63,3 @@ struct cmd_results *cmd_input(int argc, char **argv) {
current_input_config = NULL; current_input_config = NULL;
return res; return res;
} }
return cmd_results_new(CMD_BLOCK_INPUT, NULL, NULL);
}

View file

@ -16,7 +16,10 @@ struct cmd_results *cmd_seat(int argc, char **argv) {
return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL); return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL);
} }
if (argc > 2) { if ((error = checkarg(argc, "seat", EXPECTED_AT_LEAST, 3))) {
return error;
}
int argc_new = argc-2; int argc_new = argc-2;
char **argv_new = argv+2; char **argv_new = argv+2;
@ -32,6 +35,3 @@ struct cmd_results *cmd_seat(int argc, char **argv) {
current_seat_config = NULL; current_seat_config = NULL;
return res; return res;
} }
return cmd_results_new(CMD_BLOCK_SEAT, NULL, NULL);
}