about summary refs log tree commit diff
path: root/conf.c
diff options
context:
space:
mode:
authorokan <okan>2012-12-18 00:14:41 +0000
committerokan <okan>2012-12-18 00:14:41 +0000
commitb848a2b236424a33d0fcf1f07e3b4473a56604ff (patch)
treef9f0e26c5276594a2afb01707b7a3536a1cb56dd /conf.c
parent479e9f769c5a822da49ec60cd7ceb533e1739527 (diff)
downloadcwm-b848a2b236424a33d0fcf1f07e3b4473a56604ff.tar.gz
cwm-b848a2b236424a33d0fcf1f07e3b4473a56604ff.tar.xz
cwm-b848a2b236424a33d0fcf1f07e3b4473a56604ff.zip
simplify config file setup; with Tiago Cunha
Diffstat (limited to 'conf.c')
-rw-r--r--conf.c31
1 files changed, 2 insertions, 29 deletions
diff --git a/conf.c b/conf.c
index d1cbbf8..19a7a6d 100644
--- a/conf.c
+++ b/conf.c
@@ -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;