diff options
author | okan | 2014-09-06 16:14:35 +0000 |
---|---|---|
committer | okan | 2014-09-06 16:14:35 +0000 |
commit | 09c6df182c5227f2f6c12debe93eefeb2d0d8ce3 (patch) | |
tree | 1153673712afe539b26083a6a657d0e948791b0d /conf.c | |
parent | e829ebdfb7b6c439829f9be1473e94d9e0724294 (diff) | |
download | cwm-09c6df182c5227f2f6c12debe93eefeb2d0d8ce3.tar.gz |
Move termpath and lockpath into cmdq; side effect is that 'lock' and
'term' now show up in the application menu.
Diffstat (limited to 'conf.c')
-rw-r--r-- | conf.c | 32 |
1 files changed, 12 insertions, 20 deletions
@@ -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.177 2014/08/25 12:49:19 okan Exp $ + * $OpenBSD: conf.c,v 1.178 2014/09/06 16:14:35 okan Exp $ */ #include <sys/param.h> @@ -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 |