From 613abadb4bb698ab6403818557246ebe95be9ff9 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Thu, 18 Oct 2012 14:48:09 +0200 Subject: [PATCH] kmscon: drop all configs and use new /etc/kmscon/kmscon.conf This drops all config-file support except for the new /etc/kmscon/kmscon.conf. For backwards-compatibility, we still parse /etc/kmscon.conf but this will be removed soon. We want to add one kmscon-config for each seat so you can have different configurations per seat. These will all be put into /etc/kmscon/ so we need this directory. We also drop ~/.kmscon.conf. This was never really useful as kmscon is a system daemon and should not be used with user-configuration files. Signed-off-by: David Herrmann --- src/conf.c | 20 -------------------- src/conf.h | 2 -- src/kmscon_conf.c | 11 ++++++++++- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/conf.c b/src/conf.c index 77b08d0..7624b47 100644 --- a/src/conf.c +++ b/src/conf.c @@ -779,23 +779,3 @@ int conf_parse_file_f(struct conf_option *opts, size_t len, free(path); return ret; } - -int conf_parse_standard_files(struct conf_option *opts, size_t len, - const char *fname) -{ - int ret; - const char *home; - - ret = conf_parse_file_f(opts, len, "/etc/%s.conf", fname); - if (ret) - return ret; - - home = getenv("HOME"); - if (home) { - ret = conf_parse_file_f(opts, len, "%s/.%s.conf", home, fname); - if (ret) - return ret; - } - - return 0; -} diff --git a/src/conf.h b/src/conf.h index 8d194fe..9982f71 100644 --- a/src/conf.h +++ b/src/conf.h @@ -171,7 +171,5 @@ int conf_parse_argv(struct conf_option *opts, size_t len, int conf_parse_file(struct conf_option *opts, size_t len, const char *path); int conf_parse_file_f(struct conf_option *opts, size_t len, const char *format, ...); -int conf_parse_standard_files(struct conf_option *opts, size_t len, - const char *fname); #endif /* CONFIG_CONFIG_H */ diff --git a/src/kmscon_conf.c b/src/kmscon_conf.c index db7d817..3e1109f 100644 --- a/src/kmscon_conf.c +++ b/src/kmscon_conf.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "conf.h" #include "kmscon_conf.h" @@ -344,10 +345,18 @@ int kmscon_load_config(int argc, char **argv) log_print_init("kmscon"); - ret = conf_parse_standard_files(options, onum, "kmscon"); + ret = conf_parse_file_f(options, onum, "/etc/kmscon/kmscon.conf"); if (ret) return ret; + /* TODO: Deprecated! Remove this! */ + if (!access("/etc/kmscon.conf", F_OK)) { + log_error("/etc/kmscon.conf is deprecated, please use /etc/kmscon/kmscon.conf"); + ret = conf_parse_file_f(options, onum, "/etc/kmscon.conf"); + if (ret) + return ret; + } + return 0; }