X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=audioc.c;h=fa1768b52f26eb69b6806f18c42d098a0267259e;hp=a078c48c02b6a1b166f60878bab83d80bf00aac2;hb=383d1bfb5084ea5a475e408d3cc9d2e2a3de5b88;hpb=c73d23911d78ed10179c12ef8f79a3fcf3bbcdaf diff --git a/audioc.c b/audioc.c index a078c48c..fa1768b5 100644 --- a/audioc.c +++ b/audioc.c @@ -1,11 +1,12 @@ /* - * Copyright (C) 2005-2007 Andre Noll + * Copyright (C) 2005-2009 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ /** \file audioc.c the client program used to connect to para_audiod */ +#include #include #include @@ -18,10 +19,11 @@ INIT_AUDIOC_ERRLISTS; -/** the gengetopt structure containing command line args */ -struct audioc_args_info conf; +/** The gengetopt structure containing command line args. */ +static struct audioc_args_info conf; -INIT_STDERR_LOGGING(conf.loglevel_arg); +static int loglevel; +INIT_STDERR_LOGGING(loglevel); static char *concat_args(unsigned argc, char * const *argv) { @@ -87,6 +89,7 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } } + loglevel = get_loglevel_by_name(conf.loglevel_arg); args = conf.inputs_num? concat_args(conf.inputs_num, conf.inputs) : para_strdup("stat"); @@ -106,7 +109,12 @@ int main(int argc, char *argv[]) if (ret < 0) goto out; fd = ret; - + ret = mark_fd_nonblocking(fd); + if (ret < 0) + goto out; + ret = mark_fd_nonblocking(STDOUT_FILENO); + if (ret < 0) + goto out; ret = send_cred_buffer(fd, args); if (ret < 0) goto out; @@ -144,6 +152,8 @@ int main(int argc, char *argv[]) goto out; } loaded -= ret; + if (loaded && ret) + memmove(buf, buf + ret, loaded); } } out: