From: Pavel Charvat Date: Tue, 4 Sep 2007 19:49:49 +0000 (+0200) Subject: library: X-Git-Tag: holmes-import~506^2~15 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=6ca07e7bcc9e6f97b6af4c3113c388697cb914cf;p=libucw.git library: the environment variable with configuration file is now user-defined (SH_CONFIG by default) --- diff --git a/lib/conf-input.c b/lib/conf-input.c index a625630a..3b77a428 100644 --- a/lib/conf-input.c +++ b/lib/conf-input.c @@ -284,6 +284,11 @@ error: #endif char *cf_def_file = DEFAULT_CONFIG; +#ifndef ENV_VAR_CONFIG +#define ENV_VAR_CONFIG NULL +#endif +char *cf_env_file = ENV_VAR_CONFIG; + static uns postpone_commit; // only for cf_getopt() static uns everything_committed; // after the 1st load, this flag is set on @@ -381,8 +386,8 @@ load_default(void) { if (cf_def_file) { - char *env = getenv("SH_CONFIG"); - if (env) + char *env; + if (cf_env_file && (env = getenv(cf_env_file))) { if (cf_load(env)) die("Cannot load config file %s", env); diff --git a/lib/getopt.h b/lib/getopt.h index c6383ea7..b4ff823f 100644 --- a/lib/getopt.h +++ b/lib/getopt.h @@ -22,6 +22,7 @@ void reset_getopt(void); /* Safe loading and reloading of configuration files: conf-input.c */ extern char *cf_def_file; /* DEFAULT_CONFIG; NULL if already loaded */ +extern char *cf_env_file; /* ENV_VAR_CONFIG */ int cf_reload(const char *file); int cf_load(const char *file); int cf_set(const char *string);