FreeCalypso > hg > freecalypso-tools
comparison rvinterf/tmsh/audiocmd.c @ 166:2e1be0fc150e
fc-tmsh: ETM_AUDIO commands are just aul/aus/aur/auw, not audio <subcmd>
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 19 Mar 2017 17:17:57 +0000 |
parents | 86e4d8aea021 |
children | 6e4120cdb456 |
comparison
equal
deleted
inserted
replaced
165:de701ebdce1b | 166:2e1be0fc150e |
---|---|
67 cmdpkt[2] = 'R'; | 67 cmdpkt[2] = 'R'; |
68 cmdpkt[3] = param; | 68 cmdpkt[3] = param; |
69 send_etm_cmd(cmdpkt, 3); | 69 send_etm_cmd(cmdpkt, 3); |
70 return(0); | 70 return(0); |
71 } | 71 } |
72 | |
73 static struct cmdtab { | |
74 char *cmd; | |
75 int minargs; | |
76 int maxargs; | |
77 int (*func)(); | |
78 } audio_cmds[] = { | |
79 {"load", 1, 1, cmd_audio_load}, | |
80 {"read", 1, 1, cmd_audio_read}, | |
81 {"save", 1, 1, cmd_audio_save}, | |
82 {0, 0, 0, 0} | |
83 }; | |
84 | |
85 cmd_audio(argc, argv) | |
86 char **argv; | |
87 { | |
88 struct cmdtab *tp; | |
89 int extargs; | |
90 | |
91 for (tp = audio_cmds; tp->cmd; tp++) | |
92 if (!strcmp(tp->cmd, argv[1])) | |
93 break; | |
94 if (!tp->func) { | |
95 printf("error: no such audio command\n"); | |
96 return(ERROR_USAGE); | |
97 } | |
98 extargs = argc - 2; | |
99 if (extargs > tp->maxargs) { | |
100 printf("error: too many arguments\n"); | |
101 return(ERROR_USAGE); | |
102 } | |
103 if (extargs < tp->minargs) { | |
104 printf("error: too few arguments\n"); | |
105 return(ERROR_USAGE); | |
106 } | |
107 return tp->func(argc - 1, argv + 1); | |
108 } |