diff options
author | okan | 2012-12-18 00:14:41 +0000 |
---|---|---|
committer | okan | 2012-12-18 00:14:41 +0000 |
commit | 36bf81830c116600c1ee9f8c0fc8423f6e642a89 (patch) | |
tree | 21f8f33a7411e11caf0cabc2c929d31ab96117fe /conf.c | |
parent | 3a90166d0b310afb7339b6d1eebd8bb37a80324f (diff) | |
download | cwm-36bf81830c116600c1ee9f8c0fc8423f6e642a89.tar.gz |
simplify config file setup; with Tiago Cunha
Diffstat (limited to '')
-rw-r--r-- | conf.c | 33 |
1 files changed, 3 insertions, 30 deletions
@@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: conf.c,v 1.114 2012/12/17 23:54:57 okan Exp $ + * $OpenBSD: conf.c,v 1.115 2012/12/18 00:14:41 okan Exp $ */ #include <sys/param.h> @@ -166,7 +166,8 @@ conf_init(struct conf *c) { int i; - c->flags = 0; + bzero(c, sizeof(*c)); + c->bwidth = CONF_BWIDTH; c->mamount = CONF_MAMOUNT; c->snapdist = CONF_SNAPDIST; @@ -243,34 +244,6 @@ conf_clear(struct conf *c) } void -conf_setup(struct conf *c, const char *conf_file) -{ - char conf_path[MAXPATHLEN]; - struct stat sb; - int parse = 0; - - conf_init(c); - - if (conf_file == NULL) { - (void)snprintf(conf_path, sizeof(conf_path), "%s/%s", - homedir, CONFFILE); - - if (stat(conf_path, &sb) == 0 && (sb.st_mode & S_IFREG)) - parse = 1; - } else { - if (stat(conf_file, &sb) == -1 || !(sb.st_mode & S_IFREG)) - errx(1, "%s: %s", conf_file, strerror(errno)); - else { - (void)strlcpy(conf_path, conf_file, sizeof(conf_path)); - parse = 1; - } - } - - if (parse && (parse_config(conf_path, c) == -1)) - warnx("config file %s has errors, not loading", conf_path); -} - -void conf_client(struct client_ctx *cc) { struct winmatch *wm; |