diff options
| author | William Casarin <jb55@jb55.com> | 2018-07-09 22:28:25 -0700 |
|---|---|---|
| committer | William Casarin <jb55@jb55.com> | 2018-07-09 22:31:48 -0700 |
| commit | 9593fc545950782ed75f12f53238b07885559b2b (patch) | |
| tree | 9c7c2f7cbb427c54e9184cb61eedce737a6cbc6f /command.c | |
| parent | bd8c223756d2f912526ecef53bae0cc8e0c63442 (diff) | |
remove ccan for now
Diffstat (limited to 'command.c')
| -rw-r--r-- | command.c | 24 |
1 files changed, 3 insertions, 21 deletions
@@ -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; -} |
