summaryrefslogtreecommitdiff
path: root/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'command.c')
-rw-r--r--command.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/command.c b/command.c
index 2f81eaa..f3b0e91 100644
--- a/command.c
+++ b/command.c
@@ -1,10 +1,8 @@
#include "command.h"
-#include "ccan/tal/tal.h"
-#include "ccan/tal/str/str.h"
-#include "ccan/str/str.h"
#include <err.h>
+#include <string.h>
#include <unistd.h>
#include <stdio.h>
@@ -24,13 +22,13 @@ command_exec(struct command *cmd) {
int
command_num_children(struct command *cmd) {
- return tal_count(cmd) || cmd->nchildren;
+ return cmd->nchildren;
}
struct command *
command_lookup(struct command *cmd, int ncmds, const char *binding) {
for (int i = 0; i < ncmds; ++i) {
- if (streq(binding, cmd[i].bind))
+ if (strcmp(binding, cmd[i].bind) == 0)
return &cmd[i];
}
@@ -41,19 +39,3 @@ command_lookup(struct command *cmd, int ncmds, const char *binding) {
/* { .bind = "d", .name = "emacs-dev", .nchildren = 0, .children = NULL }, */
/* }; */
-struct command *
-test_root_commands(tal_t *ctx, const struct command *commands, int ncmds) {
- int i;
- struct command *cmds = NULL;
-
- cmds = tal_arr(ctx, struct command, ncmds);
-
- for (i = 0; i < ncmds; ++i) {
- cmds[i].children = commands[i].children;
- cmds[i].name = commands[i].name;
- cmds[i].bind = commands[i].bind;
- cmds[i].nchildren = commands[i].nchildren;
- }
-
- return cmds;
-}