FreeCalypso > hg > ice1-trau-tester
view 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 |
line wrap: on
line source
/* * In this module we handle user-issued stdin commands during * itt-pcm-br running session. */ #include <stdint.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <osmocom/core/select.h> #include "globals.h" static struct cmdtab { char *cmd; void (*func)(int argc, char **argv); } cmdtab[] = { {"record-a", cmd_record_a_start}, {"record-a-stop", cmd_record_a_stop}, {"record-b", cmd_record_b_start}, {"record-b-stop", cmd_record_b_stop}, {"show-a", cmd_show_a}, {"show-b", cmd_show_b}, /* table search terminator */ {NULL, NULL} }; void handle_user_cmd(int argc, char **argv) { struct cmdtab *tp; for (tp = cmdtab; tp->cmd; tp++) if (!strcmp(tp->cmd, argv[0])) break; if (!tp->func) { printf("error: unknown or unimplemented command\n"); return; } tp->func(argc, argv); }