Easy bits of arg printing for list-keys.

This commit is contained in:
Nicholas Marriott
2008-06-05 16:35:32 +00:00
parent 7325fea37d
commit 642c0b00ab
39 changed files with 485 additions and 407 deletions

12
cmd.c
View File

@ -1,4 +1,4 @@
/* $Id: cmd.c,v 1.41 2008-06-04 17:54:26 nicm Exp $ */
/* $Id: cmd.c,v 1.42 2008-06-05 16:35:32 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -114,7 +114,7 @@ cmd_parse(int argc, char **argv, char **cause)
cmd = xmalloc(sizeof *cmd);
cmd->entry = entry;
if (entry->parse != NULL) {
if (entry->parse(cmd, &cmd->data, argc, argv, cause) != 0) {
if (entry->parse(cmd, argc, argv, cause) != 0) {
xfree(cmd);
return (NULL);
}
@ -143,7 +143,7 @@ usage:
void
cmd_exec(struct cmd *cmd, struct cmd_ctx *ctx)
{
cmd->entry->exec(cmd->data, ctx);
cmd->entry->exec(cmd, ctx);
}
void
@ -164,7 +164,7 @@ cmd_send(struct cmd *cmd, struct buffer *b)
buffer_write(b, &n, sizeof n);
if (cmd->entry->send != NULL)
cmd->entry->send(cmd->data, b);
cmd->entry->send(cmd, b);
}
struct cmd *
@ -189,7 +189,7 @@ cmd_recv(struct buffer *b)
cmd->entry = *entryp;
if (cmd->entry->recv != NULL)
cmd->entry->recv(&cmd->data, b);
cmd->entry->recv(cmd, b);
return (cmd);
}
@ -197,7 +197,7 @@ void
cmd_free(struct cmd *cmd)
{
if (cmd->data != NULL && cmd->entry->free != NULL)
cmd->entry->free(cmd->data);
cmd->entry->free(cmd);
xfree(cmd);
}