]> mj.ucw.cz Git - libucw.git/commitdiff
library:
authorPavel Charvat <pavel.charvat@netcentrum.cz>
Tue, 4 Sep 2007 19:49:49 +0000 (21:49 +0200)
committerPavel Charvat <pavel.charvat@netcentrum.cz>
Tue, 4 Sep 2007 19:49:49 +0000 (21:49 +0200)
the environment variable with configuration file is now user-defined
(SH_CONFIG by default)

lib/conf-input.c
lib/getopt.h

index a625630a4f9b46731ea7d2a95970389f36904e7a..3b77a428ad94e7f6b6d7ab86d3d0d28205cfe52e 100644 (file)
@@ -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);
index c6383ea741974490dcf3ac69f498a17ddc69a120..b4ff823ffb4f43bb9087535d79a5f658dc330a53 100644 (file)
@@ -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);