diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2012-12-01 16:21:33 +0100 |
---|---|---|
committer | David Herrmann <dh.herrmann@googlemail.com> | 2012-12-01 17:27:45 +0100 |
commit | 529ad081abccbbc10fc170d8207db8a74f1b06a2 (patch) | |
tree | bb4430b9a081ff6d262abe453e14cb53b5c89509 /src/kmscon_conf.c | |
parent | 22a1e1b91bc785d505461be3b44f417ce773f828 (diff) |
conf: introduce --configdir parameter
The --configdir parameter allows specifying another configuration
directory than the default /etc/kmscon.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Diffstat (limited to 'src/kmscon_conf.c')
-rw-r--r-- | src/kmscon_conf.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/kmscon_conf.c b/src/kmscon_conf.c index 6e41cea..e48f92a 100644 --- a/src/kmscon_conf.c +++ b/src/kmscon_conf.c @@ -65,6 +65,8 @@ static void print_help() "\t-v, --verbose [off] Print verbose messages\n" "\t --debug [off] Enable debug mode\n" "\t --silent [off] Suppress notices and warnings\n" + "\t-c, --configdir </foo/bar> [/etc/kmscon]\n" + "\t Path to config directory\n" "\n" "Seat Options:\n" "\t --vt <vt-number> [auto] Select which VT to run on\n" @@ -470,6 +472,7 @@ int kmscon_conf_new(struct conf_ctx **out) CONF_OPTION_BOOL('v', "verbose", &conf->verbose, false), CONF_OPTION_BOOL_FULL(0, "debug", aftercheck_debug, NULL, NULL, &conf->debug, false), CONF_OPTION_BOOL(0, "silent", &conf->silent, false), + CONF_OPTION_STRING('c', "configdir", &conf->configdir, "/etc/kmscon"), /* Seat Options */ CONF_OPTION(0, 0, "vt", &conf_vt, aftercheck_vt, NULL, NULL, &conf->vt, NULL), @@ -569,7 +572,7 @@ int kmscon_conf_load_main(struct conf_ctx *ctx, int argc, char **argv) log_print_init("kmscon"); - ret = conf_ctx_parse_file(ctx, "/etc/kmscon/kmscon.conf"); + ret = conf_ctx_parse_file(ctx, "%s/kmscon.conf", conf->configdir); if (ret) return ret; @@ -580,6 +583,7 @@ int kmscon_conf_load_seat(struct conf_ctx *ctx, const struct conf_ctx *main, const char *seat) { int ret; + struct kmscon_conf_t *conf; if (!ctx || !main || !seat) return -EINVAL; @@ -590,7 +594,9 @@ int kmscon_conf_load_seat(struct conf_ctx *ctx, const struct conf_ctx *main, if (ret) return ret; - ret = conf_ctx_parse_file(ctx, "/etc/kmscon/%s.seat.conf", seat); + conf = conf_ctx_get_mem(ctx); + ret = conf_ctx_parse_file(ctx, "%s/%s.seat.conf", conf->configdir, + seat); if (ret) return ret; |