cvsimport

This commit is contained in:
Christian Neukirchen
2015-07-01 16:38:16 +02:00
11 changed files with 246 additions and 215 deletions

16
conf.c
View File

@ -33,14 +33,14 @@
#include "calmwm.h"
static const char *conf_bind_getmask(const char *, unsigned int *);
static void conf_cmd_remove(struct conf *, const char *);
static void conf_unbind_kbd(struct conf *, struct binding *);
static void conf_unbind_mouse(struct conf *, struct binding *);
static void conf_cmd_remove(struct conf *, const char *);
static void conf_unbind_kbd(struct conf *, struct binding *);
static void conf_unbind_mouse(struct conf *, struct binding *);
int
conf_cmd_add(struct conf *c, const char *name, const char *path)
{
struct cmd *cmd;
struct cmd *cmd, *prev;
cmd = xmalloc(sizeof(*cmd));
@ -54,6 +54,14 @@ conf_cmd_add(struct conf *c, const char *name, const char *path)
conf_cmd_remove(c, name);
TAILQ_INSERT_TAIL(&c->cmdq, cmd, entry);
/* keep queue sorted by name */
while ((prev = TAILQ_PREV(cmd, cmd_q, entry)) &&
(strcmp(prev->name, cmd->name) > 0)) {
TAILQ_REMOVE(&c->cmdq, cmd, entry);
TAILQ_INSERT_BEFORE(prev, cmd, entry);
}
return(1);
}