summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2012-10-31 22:06:25 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2012-10-31 22:06:25 +0000
commita4f1b6d4324b7c8419bce47af5ffcec40badb9b4 (patch)
treeeae21943bba7d9cfb26015a639ada42a0b791c06
parent17cb53f9b11452cfdeefa8e6cb8e2d749aaa22ad (diff)
no longer a reason to carry conf_path in struct conf, so dice.
-rw-r--r--app/cwm/calmwm.h3
-rw-r--r--app/cwm/conf.c14
-rw-r--r--app/cwm/parse.y4
3 files changed, 9 insertions, 12 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h
index e3e5f28d5..dafc935c1 100644
--- a/app/cwm/calmwm.h
+++ b/app/cwm/calmwm.h
@@ -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: calmwm.h,v 1.154 2012/10/31 19:30:19 okan Exp $
+ * $OpenBSD: calmwm.h,v 1.155 2012/10/31 22:06:24 okan Exp $
*/
#ifndef _CALMWM_H_
@@ -273,7 +273,6 @@ struct conf {
struct keybinding_q keybindingq;
struct autogroupwin_q autogroupq;
struct winmatch_q ignoreq;
- char conf_path[MAXPATHLEN];
struct cmd_q cmdq;
struct mousebinding_q mousebindingq;
#define CONF_STICKY_GROUPS 0x0001
diff --git a/app/cwm/conf.c b/app/cwm/conf.c
index 61dfe07a2..bef35b9c5 100644
--- a/app/cwm/conf.c
+++ b/app/cwm/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.101 2012/10/31 19:30:19 okan Exp $
+ * $OpenBSD: conf.c,v 1.102 2012/10/31 22:06:24 okan Exp $
*/
#include <sys/param.h>
@@ -237,6 +237,7 @@ conf_clear(struct conf *c)
void
conf_setup(struct conf *c, const char *conf_file)
{
+ char conf_path[MAXPATHLEN];
char *home;
struct stat sb;
int parse = 0;
@@ -247,23 +248,22 @@ conf_setup(struct conf *c, const char *conf_file)
if ((home = getenv("HOME")) == NULL)
errx(1, "No HOME directory.");
- (void)snprintf(c->conf_path, sizeof(c->conf_path), "%s/%s",
+ (void)snprintf(conf_path, sizeof(conf_path), "%s/%s",
home, CONFFILE);
- if (stat(c->conf_path, &sb) == 0 && (sb.st_mode & S_IFREG))
+ 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(c->conf_path, conf_file,
- sizeof(c->conf_path));
+ (void)strlcpy(conf_path, conf_file, sizeof(conf_path));
parse = 1;
}
}
- if (parse && (parse_config(c->conf_path, c) == -1))
- warnx("config file %s has errors, not loading", c->conf_path);
+ if (parse && (parse_config(conf_path, c) == -1))
+ warnx("config file %s has errors, not loading", conf_path);
}
void
diff --git a/app/cwm/parse.y b/app/cwm/parse.y
index 1cddf10a6..c45ee14a5 100644
--- a/app/cwm/parse.y
+++ b/app/cwm/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.33 2011/09/08 12:35:33 okan Exp $ */
+/* $OpenBSD: parse.y,v 1.34 2012/10/31 22:06:24 okan Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -516,8 +516,6 @@ parse_config(const char *filename, struct conf *xconf)
return (-1);
}
- (void)strlcpy(conf->conf_path, filename, sizeof(conf->conf_path));
-
conf_init(conf);
yyparse();