From 36bf81830c116600c1ee9f8c0fc8423f6e642a89 Mon Sep 17 00:00:00 2001 From: okan Date: Tue, 18 Dec 2012 00:14:41 +0000 Subject: simplify config file setup; with Tiago Cunha --- conf.c | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) (limited to 'conf.c') diff --git a/conf.c b/conf.c index a06a3e7..dd705e0 100644 --- a/conf.c +++ b/conf.c @@ -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 @@ -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; @@ -242,34 +243,6 @@ conf_clear(struct conf *c) free(c->font); } -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) { -- cgit v1.2.3-2-gb3c3