comparison abis/user_cmd.c @ 30:5dd30224b70a

abis: starting new program
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 13 Aug 2024 21:38:55 +0000
parents ater/user_cmd.c@1dda11905e85
children
comparison
equal deleted inserted replaced
29:1dda11905e85 30:5dd30224b70a
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 }