38 fprintf(stderr,
"Type 'cfsndserv -h' for usage.\n");
44 "Usage: cfsndserv [options]\n" 47 " -h display this help message\n" 48 " -v display version information\n" 92 dptr = strtok(data,
"\"");
97 fprintf(stderr,
"Sound/music command does not contain any data.\n");
104 if (data[0] !=
'\"') {
110 i = sscanf(dptr,
"%d %d %d %d %d", &x, &y, &dir, &vol, &type);
122 fprintf(stderr,
"Unrecognized sound command data format.\n");
136 dptr = strtok(NULL,
"\"");
138 fprintf(stderr,
"Sound command is missing sound/source names.\n");
146 dptr = strtok(NULL,
"\"");
148 fprintf(stderr,
"Sound command is missing the sound name.\n");
151 spacelen = strlen(dptr);
152 for (i = 0; i < spacelen; i++) {
153 if (dptr[i] !=
' ' && dptr[i] !=
'\t') {
154 fprintf(stderr,
"Invalid characters after source name.\n");
161 dptr = strtok(NULL,
"\"");
163 fprintf(stderr,
"Sound command is missing the sound name.\n");
171 soundlen = strlen(dptr);
177 i = sound - data + soundlen + 1 + 1;
179 fprintf(stderr,
"Sound or music name does not end with a quote.\n");
184 "Invalid data after sound/music name (a quoted string needed)\n");
193 "%d,%d dir=%d vol=%d type=%d source=\"%s\" sound=\"%s\"\n",
194 x, y, dir, vol, type, source, sound);
200 fprintf(stderr,
"Playing music \"%s\"\n", sound);
208 int main(
int argc,
char *argv[]) {
210 while ((flag = getopt(argc, argv,
"hv")) != -1) {
227 if (g_getenv(
"CF_SOUND_DEBUG") != NULL) {
236 while (fgets(inbuf,
sizeof(inbuf), stdin) != NULL) {
static void print_quickhelp()
static int parse_input(char *data, int len)
void cf_play_sound(gint8 x, gint8 y, guint8 dir, guint8 vol, guint8 type, char const sound[static 1], char const source[static 1])
int main(int argc, char *argv[])
void cf_play_music(const char *music_name)
static void print_version()
static void print_usage()