summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cfg.def.h7
-rw-r--r--cmdtree.c1
-rw-r--r--command.c3
-rw-r--r--command.h1
4 files changed, 7 insertions, 5 deletions
diff --git a/cfg.def.h b/cfg.def.h
index ad2c9cd..0ddbb5d 100644
--- a/cfg.def.h
+++ b/cfg.def.h
@@ -45,7 +45,7 @@ static struct command browser_commands[] = {
{ .bind = "f", .name = "firefox", .nchildren = 0, .children = NULL },
};
-static const struct command commands[] = {
+static struct command commands[] = {
{ .bind = "b",
.name = "browsers",
.nchildren = LENGTH(browser_commands),
@@ -53,8 +53,9 @@ static const struct command commands[] = {
},
{ .bind = "e",
- .name = "emacs-dev",
- .children = NULL,
+ .name = "emacs",
+ .command = "emacs-dev",
+ .children = 0,
.nchildren = 0
},
};
diff --git a/cmdtree.c b/cmdtree.c
index be8dcb5..d52920f 100644
--- a/cmdtree.c
+++ b/cmdtree.c
@@ -41,7 +41,6 @@ static XIC xic;
#include "cfg.h"
-
static int
cmdstack_push_(struct command *children, int nchildren) {
if (cmdstack_ptr + 1 >= CMDSTACK_SIZE)
diff --git a/command.c b/command.c
index 9701408..2f81eaa 100644
--- a/command.c
+++ b/command.c
@@ -17,7 +17,8 @@ command_is_prefix(struct command *cmd) {
void
command_exec(struct command *cmd) {
- execlp("/bin/sh", "sh", "-c", cmd->name, (char *) 0);
+ const char *cmdname = cmd->command == NULL ? cmd->name : cmd->command;
+ execlp("/bin/sh", "sh", "-c", cmdname, (char *) 0);
err(1, "executing command %s", cmd->name);
}
diff --git a/command.h b/command.h
index 70fc426..d4f93fb 100644
--- a/command.h
+++ b/command.h
@@ -6,6 +6,7 @@
struct command {
char *name;
+ char *command;
char *bind;
struct command *children;
int nchildren;