comparison pcm-br/user_cmd.c @ 35:499d065ee591

new program itt-pcm-br (PCM bridge)
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 28 Aug 2024 05:00:38 +0000
parents pcm/user_cmd.c@27ca01bb5b11
children
comparison
equal deleted inserted replaced
34:f0b026615f3b 35:499d065ee591
1 /*
2 * In this module we handle user-issued stdin commands during
3 * itt-pcm-br 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 {"record-a", cmd_record_a_start},
21 {"record-a-stop", cmd_record_a_stop},
22 {"record-b", cmd_record_b_start},
23 {"record-b-stop", cmd_record_b_stop},
24 {"show-a", cmd_show_a},
25 {"show-b", cmd_show_b},
26 /* table search terminator */
27 {NULL, NULL}
28 };
29
30 void handle_user_cmd(int argc, char **argv)
31 {
32 struct cmdtab *tp;
33
34 for (tp = cmdtab; tp->cmd; tp++)
35 if (!strcmp(tp->cmd, argv[0]))
36 break;
37 if (!tp->func) {
38 printf("error: unknown or unimplemented command\n");
39 return;
40 }
41 tp->func(argc, argv);
42 }