chiark
/
gitweb
/
~mdw
/
disorder
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib/configuration.c, lib/home.c: Introduce environment variables.
[disorder]
/
lib
/
configuration.c
diff --git
a/lib/configuration.c
b/lib/configuration.c
index 17f9ec7b4ed137f4f3b60aed9de3dac574b51233..56a96964d9b422ebea6289a6e09437b7aba0273e 100644
(file)
--- a/
lib/configuration.c
+++ b/
lib/configuration.c
@@
-1452,8
+1452,11
@@
char *config_get_file2(struct config *c, const char *name) {
/** @brief Set the default configuration file */
static void set_configfile(void) {
#if !_WIN32
/** @brief Set the default configuration file */
static void set_configfile(void) {
#if !_WIN32
- if(!configfile)
- byte_xasprintf(&configfile, "%s/config", pkgconfdir);
+ if(!configfile) {
+ configfile = getenv("DISORDER_CONFIG");
+ if(!configfile)
+ byte_xasprintf(&configfile, "%s/config", pkgconfdir);
+ }
#endif
}
#endif
}
@@
-1671,6
+1674,8
@@
char *config_private(void) {
/** @brief Return the path to user's personal configuration file */
char *config_userconf(void) {
/** @brief Return the path to user's personal configuration file */
char *config_userconf(void) {
+ char *t;
+ if((t = getenv("DISORDER_USERCONFIG"))) return xstrdup(t);
return profile_filename("passwd");
}
return profile_filename("passwd");
}
@@
-1680,7
+1685,9
@@
char *config_usersysconf(const struct passwd *pw) {
char *s;
set_configfile();
char *s;
set_configfile();
- if(!strchr(pw->pw_name, '/')) {
+ if((s = getenv("DISORDER_USERCONFIG_SYS")))
+ return xstrdup(s);
+ else if(!strchr(pw->pw_name, '/')) {
byte_xasprintf(&s, "%s.%s", configfile, pw->pw_name);
return s;
} else
byte_xasprintf(&s, "%s.%s", configfile, pw->pw_name);
return s;
} else