X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=spectrwm.c;h=4d4c12aabb1a77e13176f47d1a956fd176b99c7f;hb=1e065dd313274ef5dfbc451834ffdecb48e3709e;hp=5951b9e9b42bde8118d6911c123ef05d125c28df;hpb=e468d771f657f081722efc8e7b54dacd923867c2;p=spectrwm.git diff --git a/spectrwm.c b/spectrwm.c index 5951b9e..4d4c12a 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -6,8 +6,8 @@ * Copyright (c) 2010 Tuukka Kataja * Copyright (c) 2011 Jason L. Wright * Copyright (c) 2011-2012 Reginald Kennedy - * Copyright (c) 2012 Lawrence Teo - * Copyright (c) 2012 Tiago Cunha + * Copyright (c) 2011-2012 Lawrence Teo + * Copyright (c) 2011-2012 Tiago Cunha * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -83,7 +83,7 @@ #elif defined(__FreeBSD__) #include #else -#include +#include "tree.h" #endif #include @@ -6972,44 +6972,39 @@ main(int argc, char *argv[]) /* 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); - 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); - 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); - 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); - if (stat(conf, &sb) != -1) - if (S_ISREG(sb.st_mode)) - cfile = conf; 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)