summaryrefslogtreecommitdiffstats
path: root/cmd-switch-client.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2008-06-05 17:12:11 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2008-06-05 17:12:11 +0000
commitee1a7fded7653ffc2ba68a4188c89a7cb6e1bf1d (patch)
treecd72a484914cac349ddc0b8cde5ef30bdb9ca066 /cmd-switch-client.c
parent642c0b00ab43079cd251ec9616963b8a806b3464 (diff)
Print for the less easy commands.
Diffstat (limited to 'cmd-switch-client.c')
-rw-r--r--cmd-switch-client.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/cmd-switch-client.c b/cmd-switch-client.c
index 0b96e364..ddff1fef 100644
--- a/cmd-switch-client.c
+++ b/cmd-switch-client.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-switch-client.c,v 1.7 2008-06-05 16:35:32 nicm Exp $ */
+/* $Id: cmd-switch-client.c,v 1.8 2008-06-05 17:12:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -33,6 +33,7 @@ void cmd_switch_client_exec(struct cmd *, struct cmd_ctx *);
void cmd_switch_client_send(struct cmd *, struct buffer *);
void cmd_switch_client_recv(struct cmd *, struct buffer *);
void cmd_switch_client_free(struct cmd *);
+void cmd_switch_client_print(struct cmd *, char *, size_t);
struct cmd_switch_client_data {
char *cname;
@@ -49,7 +50,7 @@ const struct cmd_entry cmd_switch_client_entry = {
cmd_switch_client_recv,
cmd_switch_client_free,
NULL,
- NULL
+ cmd_switch_client_print
};
int
@@ -145,3 +146,18 @@ cmd_switch_client_free(struct cmd *self)
xfree(data->name);
xfree(data);
}
+
+void
+cmd_switch_client_print(struct cmd *self, char *buf, size_t len)
+{
+ struct cmd_switch_client_data *data = self->data;
+ size_t off = 0;
+
+ off += xsnprintf(buf, len, "%s", self->entry->name);
+ if (data == NULL)
+ return;
+ if (off < len && data->cname != NULL)
+ off += xsnprintf(buf + off, len - off, " -c %s", data->cname);
+ if (off < len && data->name != NULL)
+ off += xsnprintf(buf + off, len - off, " %s", data->name);
+}