make get_playlist_data() generic.
[paraslash.git] / audioc.c
index e20e887..66ff2a2 100644 (file)
--- a/audioc.c
+++ b/audioc.c
@@ -6,12 +6,15 @@
 
 /** \file audioc.c the client program used to connect to para_audiod */
 
+#include <sys/types.h>
+#include <dirent.h>
+
 #include "audioc.cmdline.h"
 #include "para.h"
+#include "error.h"
 #include "net.h"
 #include "string.h"
 #include "fd.h"
-#include "error.h"
 
 INIT_AUDIOC_ERRLISTS;
 
@@ -75,7 +78,13 @@ int main(int argc, char *argv[])
        HANDLE_VERSION_FLAG("audioc", conf);
        cf = configfile_exists();
        if (cf) {
-               if (audioc_cmdline_parser_configfile(cf, &conf, 0, 0, 0)) {
+               struct audioc_cmdline_parser_params params = {
+                       .override = 0,
+                       .initialize = 0,
+                       .check_required = 0,
+                       .check_ambiguity = 0
+               };
+               if (audioc_cmdline_parser_config_file(cf, &conf, &params)) {
                        fprintf(stderr, "parse error in config file\n");
                        exit(EXIT_FAILURE);
                }
@@ -97,16 +106,17 @@ int main(int argc, char *argv[])
                tmpsocket_name = make_message("%s/.paraslash/audioc_sock.%s.%s",
                        home, hn, randname);
 
-       ret = create_pf_socket(tmpsocket_name, &unix_addr, S_IRUSR | S_IWUSR);
+       ret = create_local_socket(tmpsocket_name, &unix_addr, S_IRUSR | S_IWUSR);
        unlink(tmpsocket_name);
+       free(tmpsocket_name);
        if (ret < 0)
                goto out;
        fd = ret;
        ret = -E_INIT_SOCK_ADDR;
        if (init_unix_addr(&unix_addr, socket_name) < 0)
                goto out;
-       ret = -E_AUDIOC_CONNECT;
-       if (connect(fd, (struct sockaddr *)&unix_addr, UNIX_PATH_MAX) < 0)
+       ret = PARA_CONNECT(fd, &unix_addr);
+       if (ret < 0)
                goto out;
        ret = send_cred_buffer(fd, args);
        if (ret < 0)