Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
spectrwm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e468d77
)
try multiple config files
author
Marco Peereboom
<marco@conformal.com>
Wed, 15 Feb 2012 23:26:10 +0000
(17:26 -0600)
committer
Marco Peereboom
<marco@conformal.com>
Wed, 15 Feb 2012 23:26:10 +0000
(17:26 -0600)
spectrwm.c
patch
|
blob
|
history
diff --git
a/spectrwm.c
b/spectrwm.c
index
5951b9e
..
5e9f3ef
100644
(file)
--- a/
spectrwm.c
+++ b/
spectrwm.c
@@
-6972,44
+6972,39
@@
main(int argc, char *argv[])
/* load config */
for (i = 0; ; i++) {
/* load config */
for (i = 0; ; i++) {
+ conf[0] = '\0';
switch (i) {
case 0:
/* ~ */
snprintf(conf, sizeof conf, "%s/.%s",
pwd->pw_dir, SWM_CONF_FILE);
switch (i) {
case 0:
/* ~ */
snprintf(conf, sizeof conf, "%s/.%s",
pwd->pw_dir, SWM_CONF_FILE);
- if (stat(conf, &sb) != -1)
- if (S_ISREG(sb.st_mode))
- cfile = conf;
break;
case 1:
/* global */
snprintf(conf, sizeof conf, "/etc/%s",
SWM_CONF_FILE);
break;
case 1:
/* global */
snprintf(conf, sizeof conf, "/etc/%s",
SWM_CONF_FILE);
- if (stat(conf, &sb) != -1)
- if (S_ISREG(sb.st_mode))
- cfile = conf;
break;
case 2:
/* ~ compat */
snprintf(conf, sizeof conf, "%s/.%s",
pwd->pw_dir, SWM_CONF_FILE_OLD);
break;
case 2:
/* ~ compat */
snprintf(conf, sizeof conf, "%s/.%s",
pwd->pw_dir, SWM_CONF_FILE_OLD);
- if (stat(conf, &sb) != -1)
- if (S_ISREG(sb.st_mode))
- cfile = conf;
break;
case 3:
/* global compat */
snprintf(conf, sizeof conf, "/etc/%s",
SWM_CONF_FILE_OLD);
break;
case 3:
/* global compat */
snprintf(conf, sizeof conf, "/etc/%s",
SWM_CONF_FILE_OLD);
- if (stat(conf, &sb) != -1)
- if (S_ISREG(sb.st_mode))
- cfile = conf;
break;
default:
break;
default:
- cfile = NULL;
- break;
+ goto noconfig;
}
}
+
+ if (strlen(conf) && stat(conf, &sb) != -1)
+ if (S_ISREG(sb.st_mode)) {
+ cfile = conf;
+ break;
+ }
}
}
+noconfig:
/* load conf (if any) and refresh font color in bar graphics contexts */
if (cfile && conf_load(cfile, SWM_CONF_DEFAULT) == 0)
/* load conf (if any) and refresh font color in bar graphics contexts */
if (cfile && conf_load(cfile, SWM_CONF_DEFAULT) == 0)