# HG changeset patch # User Mychaela Falconia # Date 1719255365 0 # Node ID 45411b72b6b3f7d81d496d5d7d4b900ad3d3b349 # Parent f49e57b0d1a2d54edb235f887f69776a0595615c ater: implement deact command diff -r f49e57b0d1a2 -r 45411b72b6b3 ater/activate.c --- 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; +} diff -r f49e57b0d1a2 -r 45411b72b6b3 ater/globals.h --- a/ater/globals.h Mon Jun 24 18:48:36 2024 +0000 +++ b/ater/globals.h Mon Jun 24 18:56:05 2024 +0000 @@ -17,3 +17,4 @@ void cmd_record_stop(int argc, char **argv); void cmd_print_rx(int argc, char **argv); void cmd_activate(int argc, char **argv); +void cmd_deact(int argc, char **argv); diff -r f49e57b0d1a2 -r 45411b72b6b3 ater/user_cmd.c --- a/ater/user_cmd.c Mon Jun 24 18:48:36 2024 +0000 +++ b/ater/user_cmd.c Mon Jun 24 18:56:05 2024 +0000 @@ -18,6 +18,7 @@ void (*func)(int argc, char **argv); } cmdtab[] = { {"activ", cmd_activate}, + {"deact", cmd_deact}, {"print-rx", cmd_print_rx}, {"record", cmd_record_start}, {"record-stop", cmd_record_stop},