mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Move termpath and lockpath into cmdq; side effect is that 'lock' and
'term' now show up in the application menu.
This commit is contained in:
30
conf.c
30
conf.c
@ -41,27 +41,19 @@ conf_cmd_add(struct conf *c, const char *name, const char *path)
|
||||
{
|
||||
struct cmd *cmd;
|
||||
|
||||
/* "term" and "lock" have special meanings. */
|
||||
if (strcmp(name, "term") == 0) {
|
||||
if (strlcpy(c->termpath, path, sizeof(c->termpath)) >=
|
||||
sizeof(c->termpath))
|
||||
return (0);
|
||||
} else if (strcmp(name, "lock") == 0) {
|
||||
if (strlcpy(c->lockpath, path, sizeof(c->lockpath)) >=
|
||||
sizeof(c->lockpath))
|
||||
return (0);
|
||||
} else {
|
||||
conf_cmd_remove(c, name);
|
||||
cmd = xmalloc(sizeof(*cmd));
|
||||
|
||||
cmd = xmalloc(sizeof(*cmd));
|
||||
|
||||
cmd->name = xstrdup(name);
|
||||
if (strlcpy(cmd->path, path, sizeof(cmd->path)) >=
|
||||
sizeof(cmd->path))
|
||||
return (0);
|
||||
TAILQ_INSERT_TAIL(&c->cmdq, cmd, entry);
|
||||
cmd->name = xstrdup(name);
|
||||
if (strlcpy(cmd->path, path, sizeof(cmd->path)) >= sizeof(cmd->path)) {
|
||||
free(cmd->name);
|
||||
free(cmd);
|
||||
return(0);
|
||||
}
|
||||
return (1);
|
||||
|
||||
conf_cmd_remove(c, name);
|
||||
|
||||
TAILQ_INSERT_TAIL(&c->cmdq, cmd, entry);
|
||||
return(1);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user