-static int set_backend(const struct config_state *cs,
- const struct conf *whoami,
- int nvec, char **vec) {
- int *const valuep = ADDRESS(cs->config, int);
-
- if(nvec != 1) {
- error(0, "%s:%d: '%s' requires one argument",
- cs->path, cs->line, whoami->name);
- return -1;
- }
- if(!strcmp(vec[0], "alsa")) {
-#if HAVE_ALSA_ASOUNDLIB_H
- *valuep = BACKEND_ALSA;
-#else
- error(0, "%s:%d: ALSA is not available on this platform",
- cs->path, cs->line);
- return -1;
-#endif
- } else if(!strcmp(vec[0], "command"))
- *valuep = BACKEND_COMMAND;
- else if(!strcmp(vec[0], "network"))
- *valuep = BACKEND_NETWORK;
- else if(!strcmp(vec[0], "coreaudio")) {
-#if HAVE_COREAUDIO_AUDIOHARDWARE_H
- *valuep = BACKEND_COREAUDIO;
-#else
- error(0, "%s:%d: Core Audio is not available on this platform",
- cs->path, cs->line);
- return -1;
-#endif
- } else if(!strcmp(vec[0], "oss")) {
-#if HAVE_SYS_SOUNDCARD_H
- *valuep = BACKEND_OSS;
-#else
- error(0, "%s:%d: OSS is not available on this platform",
- cs->path, cs->line);
- return -1;
-#endif
- } else {
- error(0, "%s:%d: invalid '%s' value '%s'",
- cs->path, cs->line, whoami->name, vec[0]);
- return -1;
- }
- return 0;
-}
-