mirror of
https://github.com/emersion/kanshi
synced 2024-11-23 00:02:16 +01:00
Extract config file logic into read_config
This commit is contained in:
parent
7952a0b691
commit
7ded2ed05c
10
main.c
10
main.c
@ -195,7 +195,7 @@ static const struct wl_registry_listener registry_listener = {
|
||||
.global_remove = registry_handle_global_remove,
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
static struct kanshi_config *read_config(void) {
|
||||
const char config_filename[] = "kanshi/config";
|
||||
char config_path[PATH_MAX];
|
||||
const char *xdg_config_home = getenv("XDG_CONFIG_HOME");
|
||||
@ -208,10 +208,14 @@ int main(int argc, char *argv[]) {
|
||||
home, config_filename);
|
||||
} else {
|
||||
fprintf(stderr, "HOME not set\n");
|
||||
return EXIT_FAILURE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct kanshi_config *config = parse_config(config_path);
|
||||
return parse_config(config_path);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
struct kanshi_config *config = read_config();
|
||||
if (config == NULL) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user