comparison ft16/user_cmd.c @ 2:5c18cd38c8ad

ft16: import from ice1-trau-tester/abis
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 29 Aug 2024 13:07:16 +0000
parents
children adcdbb2e30fe
comparison
equal deleted inserted replaced
1:e5527fc2050b 2:5c18cd38c8ad
1 /*
2 * In this module we handle user-issued stdin commands during
3 * itt-abis-16 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 {"print-rx", cmd_print_rx},
21 {"record", cmd_record_start},
22 {"record-stop", cmd_record_stop},
23 /* table search terminator */
24 {NULL, NULL}
25 };
26
27 void handle_user_cmd(int argc, char **argv)
28 {
29 struct cmdtab *tp;
30
31 for (tp = cmdtab; tp->cmd; tp++)
32 if (!strcmp(tp->cmd, argv[0]))
33 break;
34 if (!tp->func) {
35 printf("error: unknown or unimplemented command\n");
36 return;
37 }
38 tp->func(argc, argv);
39 }