kill some more unneeded includes
[paraslash.git] / audioc.c
index 8d8ad35f1e8c2080816d9da7ccf9e6a5a0363205..3cc5b0bd7b4d2e385a902f1b241abe779d8207fa 100644 (file)
--- a/audioc.c
+++ b/audioc.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005-2006 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2005-2007 Andre Noll <maan@systemlinux.org>
  *
  *     This program is free software; you can redistribute it and/or modify
  *     it under the terms of the GNU General Public License as published by
 
 INIT_AUDIOC_ERRLISTS;
 
-struct gengetopt_args_info conf;
-char *tmpfifo;
+/** the gengetopt structure containing command line args */
+struct audioc_args_info conf;
 
-
-/*
- * client log function
- */
-void para_log(int ll, const char* fmt,...)
-{
-       va_list argp;
-
-       /* ignore log message if loglevel is not high enough */
-       if (ll < conf.loglevel_arg)
-               return;
-       va_start(argp, fmt);
-       vfprintf(stderr, fmt, argp);
-       va_end(argp);
-}
+INIT_STDERR_LOGGING(conf.loglevel_arg);
 
 static char *concat_args(const int argc, char * const *argv)
 {
@@ -73,6 +59,21 @@ static char *configfile_exists(void)
        return NULL;
 }
 
+/**
+ * the client program to connect to para_audiod
+ *
+ * \param argc usual argument count
+ * \param argv usual argument vector
+ *
+ * It creates a temporary local socket in order to communicate with para_audiod.
+ * Authentication consists in sending a ucred buffer that contains the user id.
+ *
+ * Any output received through the local socket is sent to stdout.
+ *
+ * \return EXIT_SUCCESS or EXIT_FAILURE
+ *
+ * \sa send_cred_buffer(), para_audioc(1), para_audiod(1).
+ */
 int main(int argc, char *argv[])
 {
        struct sockaddr_un unix_addr;
@@ -81,11 +82,12 @@ int main(int argc, char *argv[])
                *buf = NULL, *hn = para_hostname(), *args, *home = para_homedir();
 
 
-       if (cmdline_parser(argc, argv, &conf))
+       if (audioc_cmdline_parser(argc, argv, &conf))
                goto out;
+       HANDLE_VERSION_FLAG("audioc", conf);
        cf = configfile_exists();
        if (cf) {
-               if (cmdline_parser_configfile(cf, &conf, 0, 0, 0)) {
+               if (audioc_cmdline_parser_configfile(cf, &conf, 0, 0, 0)) {
                        fprintf(stderr, "parse error in config file\n");
                        exit(EXIT_FAILURE);
                }
@@ -117,7 +119,6 @@ int main(int argc, char *argv[])
        ret = - E_AUDIOC_CONNECT;
        if (connect(fd, (struct sockaddr *)&unix_addr, UNIX_PATH_MAX) < 0)
                goto out;
-       fprintf(stderr, "loaded: %d\n", loaded);
        ret = send_cred_buffer(fd, args);
        if (ret < 0)
                goto out;
@@ -127,8 +128,6 @@ int main(int argc, char *argv[])
                fd_set rfd, wfd;
                FD_ZERO(&rfd);
                FD_ZERO(&wfd);
-               if (loaded && loaded > 10000)
-                       fprintf(stderr, "loaded: %d\n", loaded);
                if (loaded < conf.bufsize_arg)
                        para_fd_set(fd, &rfd, &max_fileno);
                if (loaded > 0) {