FreeCalypso > hg > ice1-trau-tester
view pcm-br/user_cmd.c @ 38:f7a1a2765e21
README: update for current state
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 29 Aug 2024 19:42:22 +0000 |
parents | 499d065ee591 |
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); }