char *default_server = NULL;
pa_client_conf *c = pa_client_conf_new();
- pa_client_conf_load(c, NULL);
+ pa_client_conf_load(c);
#ifdef HAVE_X11
- pa_client_conf_from_x11(c, NULL);
+ pa_client_conf_from_x11(c);
#endif
pa_client_conf_env(c);
*address = NULL;
- if (pa_client_conf_load(conf, NULL) < 0) {
+ if (pa_client_conf_load(conf) < 0) {
r = FAILED_TO_LOAD_CLIENT_CONF;
goto finish;
}
#include "client-conf-x11.h"
-int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) {
+int pa_client_conf_from_x11(pa_client_conf *c) {
+ const char *dname;
xcb_connection_t *xcb = NULL;
int ret = -1, screen = 0;
char t[1024];
pa_assert(c);
- if (!dname && !(dname = getenv("DISPLAY")))
+ if (!(dname = getenv("DISPLAY")))
goto finish;
if (*dname == 0)
#include "client-conf.h"
-/* Load client configuration data from the specified X11 display,
- * overwriting the current settings in *c */
-int pa_client_conf_from_x11(pa_client_conf *c, const char *display);
+/* Load client configuration data from X11, overwriting the current settings in
+ * *c. */
+int pa_client_conf_from_x11(pa_client_conf *c);
#endif
pa_xfree(c);
}
-int pa_client_conf_load(pa_client_conf *c, const char *filename) {
+int pa_client_conf_load(pa_client_conf *c) {
FILE *f = NULL;
char *fn = NULL;
int r = -1;
{ NULL, NULL, NULL, NULL },
};
- if (filename) {
-
- if (!(f = pa_fopen_cloexec(filename, "r"))) {
- pa_log(_("Failed to open configuration file '%s': %s"), fn, pa_cstrerror(errno));
+ if (!(f = pa_open_config_file(DEFAULT_CLIENT_CONFIG_FILE, DEFAULT_CLIENT_CONFIG_FILE_USER, ENV_CLIENT_CONFIG_FILE, &fn)))
+ if (errno != ENOENT)
goto finish;
- }
-
- fn = pa_xstrdup(fn);
-
- } else {
-
- if (!(f = pa_open_config_file(DEFAULT_CLIENT_CONFIG_FILE, DEFAULT_CLIENT_CONFIG_FILE_USER, ENV_CLIENT_CONFIG_FILE, &fn)))
- if (errno != ENOENT)
- goto finish;
- }
r = f ? pa_config_parse(fn, f, table, NULL, NULL) : 0;
pa_client_conf *pa_client_conf_new(void);
void pa_client_conf_free(pa_client_conf *c);
-/* Load the configuration data from the specified file, overwriting
- * the current settings in *c. When the filename is NULL, the
- * default client configuration file name is used. */
-int pa_client_conf_load(pa_client_conf *c, const char *filename);
+/* Load the configuration data from the client configuration file, overwriting
+ * the current settings in *c. */
+int pa_client_conf_load(pa_client_conf *c);
/* Load the configuration data from the environment of the current
process, overwriting the current settings in *c. */
#endif
c->conf = pa_client_conf_new();
- pa_client_conf_load(c->conf, NULL);
+ pa_client_conf_load(c->conf);
#ifdef HAVE_X11
- pa_client_conf_from_x11(c->conf, NULL);
+ pa_client_conf_from_x11(c->conf);
#endif
pa_client_conf_env(c->conf);
char hx[PA_NATIVE_COOKIE_LENGTH*2+1];
assert(conf);
- if (pa_client_conf_load(conf, NULL) < 0) {
+ if (pa_client_conf_load(conf) < 0) {
fprintf(stderr, _("Failed to load client configuration file.\n"));
goto finish;
}