FreeCalypso > hg > ice1-trau-tester
diff ater/activate.c @ 25:45411b72b6b3
ater: implement deact command
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 24 Jun 2024 18:56:05 +0000 |
parents | f49e57b0d1a2 |
children | 237687e2be6c |
line wrap: on
line diff
--- a/ater/activate.c Mon Jun 24 18:48:36 2024 +0000 +++ b/ater/activate.c Mon Jun 24 18:56:05 2024 +0000 @@ -71,3 +71,23 @@ trau_frame_from_record(init_frame, is_efr, &at->ul_frame); free(init_frame); } + +void cmd_deact(int argc, char **argv) +{ + int nr; + struct ater_subslot *at; + + if (argc != 2) { +usage: fprintf(stderr, "usage: %s 0|1|2|3\n", argv[0]); + return; + } + if (argv[1][0] < '0' || argv[1][0] > '3' || argv[1][1]) + goto usage; + nr = argv[1][0] - '0'; + at = &subslots[nr]; + if (!at->is_active) { + fprintf(stderr, "error: subslot %d is not active\n", nr); + return; + } + at->is_active = false; +}