summaryrefslogtreecommitdiffstats
path: root/cmd.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2021-08-21 16:01:26 +0100
committerThomas Adam <thomas@xteddy.org>2021-08-21 16:01:26 +0100
commit4d3367e9657002c4b68867c8d58e2f5b7ae90612 (patch)
treebedc8f8f2f55f7b444ac0427be0e7e0dd1ef6daa /cmd.c
parent62036121fa3f69a93031f90956e659e090d79a1f (diff)
parent68cacaec68ca8300e0ea439abdf9db16e74241bb (diff)
Merge branch 'obsd-master' into master
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/cmd.c b/cmd.c
index c4c62fc6..ffa496a5 100644
--- a/cmd.c
+++ b/cmd.c
@@ -221,10 +221,6 @@ struct cmd {
char *file;
u_int line;
- char *alias;
- int argc;
- char **argv;
-
TAILQ_ENTRY(cmd) qentry;
};
TAILQ_HEAD(cmds, cmd);
@@ -529,10 +525,6 @@ cmd_parse(int argc, char **argv, const char *file, u_int line, char **cause)
cmd->file = xstrdup(file);
cmd->line = line;
- cmd->alias = NULL;
- cmd->argc = argc;
- cmd->argv = cmd_copy_argv(argc, argv);
-
return (cmd);
usage:
@@ -546,9 +538,6 @@ usage:
void
cmd_free(struct cmd *cmd)
{
- free(cmd->alias);
- cmd_free_argv(cmd->argc, cmd->argv);
-
free(cmd->file);
args_free(cmd->args);
@@ -593,7 +582,18 @@ cmd_list_append(struct cmd_list *cmdlist, struct cmd *cmd)
TAILQ_INSERT_TAIL(cmdlist->list, cmd, qentry);
}
-/* Move all commands from one command list to another */
+/* Append all commands from one list to another. */
+void
+cmd_list_append_all(struct cmd_list *cmdlist, struct cmd_list *from)
+{
+ struct cmd *cmd;
+
+ TAILQ_FOREACH(cmd, from->list, qentry)
+ cmd->group = cmdlist->group;
+ TAILQ_CONCAT(cmdlist->list, from->list, qentry);
+}
+
+/* Move all commands from one command list to another. */
void
cmd_list_move(struct cmd_list *cmdlist, struct cmd_list *from)
{