FreeCalypso > hg > ice1-trau-tester
changeset 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 |
files | ater/activate.c ater/globals.h ater/user_cmd.c |
diffstat | 3 files changed, 22 insertions(+), 0 deletions(-) [+] |
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; +}
--- 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);
--- 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},