/*
- * Copyright (C) 2005-2012 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2005-2013 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
para_fd_set(at->fd, &s->rfds, &s->max_fileno);
}
-static void audioc_post_select(struct sched *s, struct task *t)
+static int audioc_post_select(struct sched *s, struct task *t)
{
char *buf = NULL;
struct audioc_task *at = container_of(t, struct audioc_task, task);
if (ret < 0)
goto out;
if (!FD_ISSET(at->fd, &s->rfds))
- return;
+ return 0;
buf = para_malloc(conf.bufsize_arg);
ret = recv_bin_buffer(at->fd, buf, conf.bufsize_arg);
PARA_DEBUG_LOG("recv: %d\n", ret);
if (ret < 0)
goto out;
btr_add_output(buf, ret, at->btrn);
- return;
+ return 0;
out:
if (ret < 0) {
free(buf);
- btr_remove_node(at->btrn);
- btr_free_node(at->btrn);
- at->btrn = NULL;
+ btr_remove_node(&at->btrn);
close(at->fd);
}
- t->error = ret;
+ return ret;
}
static struct audioc_task audioc_task = {
*/
int main(int argc, char *argv[])
{
- int ret = -E_AUDIOC_SYNTAX, fd;
+ int ret, fd;
char *cf, *buf = NULL, *args = NULL;
size_t bufsize;
- if (audioc_cmdline_parser(argc, argv, &conf))
- goto out;
+ audioc_cmdline_parser(argc, argv, &conf);
HANDLE_VERSION_FLAG("audioc", conf);
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
cf = configfile_exists();
if (cf) {
struct audioc_cmdline_parser_params params = {
.override = 0,
.initialize = 0,
.check_required = 0,
- .check_ambiguity = 0
+ .check_ambiguity = 0,
+ .print_errors = 1,
+
};
- ret = audioc_cmdline_parser_config_file(cf, &conf, ¶ms);
+ audioc_cmdline_parser_config_file(cf, &conf, ¶ms);
free(cf);
- if (ret) {
- fprintf(stderr, "parse error in config file\n");
- exit(EXIT_FAILURE);
- }
+ loglevel = get_loglevel_by_name(conf.loglevel_arg);
}
- loglevel = get_loglevel_by_name(conf.loglevel_arg);
if (conf.socket_given)
socket_name = para_strdup(conf.socket_arg);
else {