FreeCalypso > hg > ice1-trau-tester
comparison ater8/user_cmd.c @ 42:ff94d7fc5891
new program itt-ater-8
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 30 Aug 2024 19:02:42 +0000 |
parents | ater/user_cmd.c@1dda11905e85 |
children | 3cc26391d24d |
comparison
equal
deleted
inserted
replaced
41:50a72d4ff498 | 42:ff94d7fc5891 |
---|---|
1 /* | |
2 * In this module we handle user-issued stdin commands during | |
3 * itt-ater-8 running session. | |
4 */ | |
5 | |
6 #include <stdint.h> | |
7 #include <stdbool.h> | |
8 #include <stdio.h> | |
9 #include <stdlib.h> | |
10 #include <string.h> | |
11 | |
12 #include <osmocom/core/select.h> | |
13 | |
14 #include "globals.h" | |
15 | |
16 static struct cmdtab { | |
17 char *cmd; | |
18 void (*func)(int argc, char **argv); | |
19 } cmdtab[] = { | |
20 {"activ", cmd_activate}, | |
21 {"deact", cmd_deact}, | |
22 {"play", cmd_play_file}, | |
23 {"play-stop", cmd_play_stop}, | |
24 {"print-rx", cmd_print_rx}, | |
25 {"record", cmd_record_start}, | |
26 {"record-stop", cmd_record_stop}, | |
27 /* table search terminator */ | |
28 {NULL, NULL} | |
29 }; | |
30 | |
31 void handle_user_cmd(int argc, char **argv) | |
32 { | |
33 struct cmdtab *tp; | |
34 | |
35 for (tp = cmdtab; tp->cmd; tp++) | |
36 if (!strcmp(tp->cmd, argv[0])) | |
37 break; | |
38 if (!tp->func) { | |
39 printf("error: unknown or unimplemented command\n"); | |
40 return; | |
41 } | |
42 tp->func(argc, argv); | |
43 } |