diff options
author | okan <okan> | 2014-01-28 20:22:21 +0000 |
---|---|---|
committer | okan <okan> | 2014-01-28 20:22:21 +0000 |
commit | 2b233f0548bb026eebb336bcdac57e48f0839e5c (patch) | |
tree | f4a0233043a95850cea77fd62df694e17984251a /parse.y | |
parent | 5fd119daea8de1e84f382e7651c996fd861974b9 (diff) | |
parent | c28467cda5323f2251ed16a407fd77b7ec9e5ba6 (diff) | |
download | cwm-2b233f0548bb026eebb336bcdac57e48f0839e5c.tar.gz cwm-2b233f0548bb026eebb336bcdac57e48f0839e5c.tar.xz cwm-2b233f0548bb026eebb336bcdac57e48f0839e5c.zip |
cvsimport
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 70 |
1 files changed, 7 insertions, 63 deletions
diff --git a/parse.y b/parse.y index 6fbeb8d..861dfb9 100644 --- a/parse.y +++ b/parse.y @@ -153,7 +153,11 @@ main : FONTNAME STRING { free($3); } | IGNORE STRING { - conf_ignore(conf, $2); + if (!conf_ignore(conf, $2)) { + yyerror("ignore windowname too long"); + free($2); + YYERROR; + } free($2); } | BIND STRING string { @@ -547,78 +551,18 @@ popfile(void) int parse_config(const char *filename, struct conf *xconf) { - int errors = 0; + int errors = 0; - conf = xcalloc(1, sizeof(*conf)); + conf = xconf; if ((file = pushfile(filename)) == NULL) { - free(conf); return (-1); } topfile = file; - conf_init(conf); - yyparse(); errors = file->errors; popfile(); - if (errors) { - conf_clear(conf); - } - else { - struct autogroupwin *ag; - struct keybinding *kb; - struct winmatch *wm; - struct cmd *cmd; - struct mousebinding *mb; - int i; - - conf_clear(xconf); - - xconf->flags = conf->flags; - xconf->bwidth = conf->bwidth; - xconf->mamount = conf->mamount; - xconf->snapdist = conf->snapdist; - xconf->gap = conf->gap; - - while ((cmd = TAILQ_FIRST(&conf->cmdq)) != NULL) { - TAILQ_REMOVE(&conf->cmdq, cmd, entry); - TAILQ_INSERT_TAIL(&xconf->cmdq, cmd, entry); - } - - while ((kb = TAILQ_FIRST(&conf->keybindingq)) != NULL) { - TAILQ_REMOVE(&conf->keybindingq, kb, entry); - TAILQ_INSERT_TAIL(&xconf->keybindingq, kb, entry); - } - - while ((ag = TAILQ_FIRST(&conf->autogroupq)) != NULL) { - TAILQ_REMOVE(&conf->autogroupq, ag, entry); - TAILQ_INSERT_TAIL(&xconf->autogroupq, ag, entry); - } - - while ((wm = TAILQ_FIRST(&conf->ignoreq)) != NULL) { - TAILQ_REMOVE(&conf->ignoreq, wm, entry); - TAILQ_INSERT_TAIL(&xconf->ignoreq, wm, entry); - } - - while ((mb = TAILQ_FIRST(&conf->mousebindingq)) != NULL) { - TAILQ_REMOVE(&conf->mousebindingq, mb, entry); - TAILQ_INSERT_TAIL(&xconf->mousebindingq, mb, entry); - } - - (void)strlcpy(xconf->termpath, conf->termpath, - sizeof(xconf->termpath)); - (void)strlcpy(xconf->lockpath, conf->lockpath, - sizeof(xconf->lockpath)); - - for (i = 0; i < CWM_COLOR_NITEMS; i++) - xconf->color[i] = conf->color[i]; - - xconf->font = conf->font; - } - - free(conf); - return (errors ? -1 : 0); } |