X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fconf-input.c;h=c5d2527772548911bd3f163b115392e90f2f3035;hb=c4bf633211b0424492b5a3937d6a6d2e0d79a4cf;hp=a625630a4f9b46731ea7d2a95970389f36904e7a;hpb=8f01c7e5788479a93d75bca01f4e47013f0fba67;p=libucw.git diff --git a/lib/conf-input.c b/lib/conf-input.c index a625630a..c5d25277 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,15 +386,20 @@ 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); } - if (cf_load(cf_def_file)) + else if (cf_load(cf_def_file)) die("Cannot load default config %s", cf_def_file); } + else + { + // We need to create an empty pool + cf_journal_commit_transaction(1, cf_journal_new_transaction(1)); + } } static void