mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
no longer a reason to carry conf_path in struct conf, so dice.
This commit is contained in:
parent
4fb420514d
commit
620af2e52d
1
calmwm.h
1
calmwm.h
@ -273,7 +273,6 @@ struct conf {
|
|||||||
struct keybinding_q keybindingq;
|
struct keybinding_q keybindingq;
|
||||||
struct autogroupwin_q autogroupq;
|
struct autogroupwin_q autogroupq;
|
||||||
struct winmatch_q ignoreq;
|
struct winmatch_q ignoreq;
|
||||||
char conf_path[MAXPATHLEN];
|
|
||||||
struct cmd_q cmdq;
|
struct cmd_q cmdq;
|
||||||
struct mousebinding_q mousebindingq;
|
struct mousebinding_q mousebindingq;
|
||||||
#define CONF_STICKY_GROUPS 0x0001
|
#define CONF_STICKY_GROUPS 0x0001
|
||||||
|
12
conf.c
12
conf.c
@ -237,6 +237,7 @@ conf_clear(struct conf *c)
|
|||||||
void
|
void
|
||||||
conf_setup(struct conf *c, const char *conf_file)
|
conf_setup(struct conf *c, const char *conf_file)
|
||||||
{
|
{
|
||||||
|
char conf_path[MAXPATHLEN];
|
||||||
char *home;
|
char *home;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
int parse = 0;
|
int parse = 0;
|
||||||
@ -247,23 +248,22 @@ conf_setup(struct conf *c, const char *conf_file)
|
|||||||
if ((home = getenv("HOME")) == NULL)
|
if ((home = getenv("HOME")) == NULL)
|
||||||
errx(1, "No HOME directory.");
|
errx(1, "No HOME directory.");
|
||||||
|
|
||||||
(void)snprintf(c->conf_path, sizeof(c->conf_path), "%s/%s",
|
(void)snprintf(conf_path, sizeof(conf_path), "%s/%s",
|
||||||
home, CONFFILE);
|
home, CONFFILE);
|
||||||
|
|
||||||
if (stat(c->conf_path, &sb) == 0 && (sb.st_mode & S_IFREG))
|
if (stat(conf_path, &sb) == 0 && (sb.st_mode & S_IFREG))
|
||||||
parse = 1;
|
parse = 1;
|
||||||
} else {
|
} else {
|
||||||
if (stat(conf_file, &sb) == -1 || !(sb.st_mode & S_IFREG))
|
if (stat(conf_file, &sb) == -1 || !(sb.st_mode & S_IFREG))
|
||||||
errx(1, "%s: %s", conf_file, strerror(errno));
|
errx(1, "%s: %s", conf_file, strerror(errno));
|
||||||
else {
|
else {
|
||||||
(void)strlcpy(c->conf_path, conf_file,
|
(void)strlcpy(conf_path, conf_file, sizeof(conf_path));
|
||||||
sizeof(c->conf_path));
|
|
||||||
parse = 1;
|
parse = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parse && (parse_config(c->conf_path, c) == -1))
|
if (parse && (parse_config(conf_path, c) == -1))
|
||||||
warnx("config file %s has errors, not loading", c->conf_path);
|
warnx("config file %s has errors, not loading", conf_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user