Merge branch 'master' of git.philpep.org:wmfs into philpep

This commit is contained in:
Philippe Pepiot
2010-04-13 20:51:01 +02:00
2 changed files with 20 additions and 18 deletions

View File

@@ -281,17 +281,18 @@ conf_client_section(void)
mouse = fetch_section(titlebar[0], "mouse"); mouse = fetch_section(titlebar[0], "mouse");
for(n = 0; sec[n]; n++); for(n = 0; mouse[n]; n++);
if((conf.titlebar.nmouse = n) > 0) if((conf.titlebar.nmouse = n) > 0)
{ {
conf.titlebar.mouse = emalloc(conf.titlebar.nmouse, sizeof(MouseBinding)); conf.titlebar.mouse = emalloc(conf.titlebar.nmouse, sizeof(MouseBinding));
mouse_section(conf.titlebar.mouse, n, mouse); mouse_section(conf.titlebar.mouse, n, mouse);
} }
free(mouse); free(mouse);
/* Multi button part */ /* Multi button part */
button = fetch_section(sec[0], "button"); button = fetch_section(titlebar[0], "button");
for(n = 0; button[n]; n++); for(n = 0; button[n]; n++);
@@ -487,7 +488,7 @@ conf_tag_section(void)
for(i = 0; i < sc; ++i) for(i = 0; i < sc; ++i)
tags[i] = emalloc(n + 2, sizeof(Tag)); tags[i] = emalloc(n + 2, sizeof(Tag));
for(i = (n-1); i >= 0; i--) for(i = (n - 1); i >= 0; i--)
{ {
j = fetch_opt(tag[i], "-1", "screen")[0].num; j = fetch_opt(tag[i], "-1", "screen")[0].num;
@@ -566,7 +567,7 @@ void
conf_menu_section(void) conf_menu_section(void)
{ {
char *tmp2; char *tmp2;
int i, j, n; int i, j, aj, n;
struct conf_sec **menu, **set_menu, **item; struct conf_sec **menu, **set_menu, **item;
menu = fetch_section(NULL, "menu"); menu = fetch_section(NULL, "menu");
@@ -611,13 +612,14 @@ conf_menu_section(void)
if((conf.menu[i].nitem = n)) if((conf.menu[i].nitem = n))
{ {
conf.menu[i].item = emalloc(conf.menu[i].nitem, sizeof(MenuItem)); conf.menu[i].item = emalloc(conf.menu[i].nitem, sizeof(MenuItem));
for(j = 0; j < conf.menu[i].nitem; ++j) for(j = 0; j < n; ++j)
{ {
conf.menu[i].item[j].name = fetch_opt(item[j], "item_wname", "name")[0].str; aj = (n - 1) - j;
conf.menu[i].item[j].func = name_to_func(fetch_opt(item[j], "", "func")[0].str, func_list); conf.menu[i].item[aj].name = fetch_opt(item[j], "item_wname", "name")[0].str;
conf.menu[i].item[j].cmd = fetch_opt(item[j], "", "cmd")[0].str; conf.menu[i].item[aj].func = name_to_func(fetch_opt(item[j], "", "func")[0].str, func_list);
conf.menu[i].item[j].check = name_to_func(fetch_opt(item[j], "", "check")[0].str, func_list); conf.menu[i].item[aj].cmd = fetch_opt(item[j], "", "cmd")[0].str;
conf.menu[i].item[j].submenu = fetch_opt(item[j], "", "submenu")[0].str; conf.menu[i].item[aj].check = name_to_func(fetch_opt(item[j], "", "check")[0].str, func_list);
conf.menu[i].item[aj].submenu = fetch_opt(item[j], "", "submenu")[0].str;
} }
} }
free(item); free(item);

View File

@@ -225,7 +225,7 @@ get_conf(const char *name)
SLIST_INSERT_HEAD(&config, s, entry); SLIST_INSERT_HEAD(&config, s, entry);
break; break;
default: default:
errx(1, "%s:%d: near '%s', config out of any section", errx(1, "%s:%lu: near '%s', config out of any section",
file.name, curk->line, curw->name); file.name, curk->line, curw->name);
break; break;
} }
@@ -246,7 +246,7 @@ get_section(void)
pop_keyword(); pop_keyword();
if (curk->type != WORD) if (curk->type != WORD)
errx(1, "%s:%d: near '%s', missing section name", errx(1, "%s:%lu: near '%s', missing section name",
file.name, curk->line, curw->name); file.name, curk->line, curw->name);
pop_keyword(); pop_keyword();
@@ -264,7 +264,7 @@ get_section(void)
case SEC_END: case SEC_END:
break; break;
default: default:
errx(1, "%s:%d: near '%s', syntax error", errx(1, "%s:%lu: near '%s', syntax error",
file.name, curk->line, curw->name); file.name, curk->line, curw->name);
break; break;
} }
@@ -272,11 +272,11 @@ get_section(void)
pop_keyword(); pop_keyword();
if (curk->type != WORD) if (curk->type != WORD)
errx(1, "%s:%d: near '%s', missing end-section name", errx(1, "%s:%lu: near '%s', missing end-section name",
file.name, curk->line, curw->name); file.name, curk->line, curw->name);
if (strcmp(curw->name, s->name)) if (strcmp(curw->name, s->name))
errx(1, "%s:%d: near '%s', non-closed section '%s'", errx(1, "%s:%lu: near '%s', non-closed section '%s'",
file.name, curk->line, curw->name, s->name); file.name, curk->line, curw->name, s->name);
pop_stack(); pop_stack();
@@ -297,7 +297,7 @@ get_option(void)
pop_keyword(); pop_keyword();
if (curk->type != EQUAL) if (curk->type != EQUAL)
errx(1, "%s:%d: near '%s', missing '=' here", errx(1, "%s:%lu: near '%s', missing '=' here",
file.name, curk->line, curw->name); file.name, curk->line, curw->name);
pop_keyword(); pop_keyword();
@@ -312,7 +312,7 @@ get_option(void)
pop_keyword(); pop_keyword();
while (curk->type != LIST_END) { while (curk->type != LIST_END) {
if (curk->type != WORD) if (curk->type != WORD)
errx(1, "%s:%d: near '%s', declaration into a list", errx(1, "%s:%lu: near '%s', declaration into a list",
file.name, curk->line, curw->name); file.name, curk->line, curw->name);
o->val[j++] = strdup(curw->name); o->val[j++] = strdup(curw->name);
pop_stack(); pop_stack();
@@ -321,7 +321,7 @@ get_option(void)
o->val[j] = NULL; o->val[j] = NULL;
break; break;
default: default:
errx(1, "%s:%d: near '%s', syntax error", errx(1, "%s:%lu: near '%s', syntax error",
file.name, curk->line, curw->name); file.name, curk->line, curw->name);
break; break;
} }