diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-18 14:40:48 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-18 14:40:48 +0000 |
commit | a15f8fc4a66420615d237313c6a01fcf532c52a2 (patch) | |
tree | 751d858639e20ae413ec907f7cf3215c06e3820d /cmd-switch-client.c | |
parent | c4d5989a4ef03db0477446ee004ef431be268286 (diff) |
Support command sequences separated by " ; ". Also clean up command printing.
Diffstat (limited to 'cmd-switch-client.c')
-rw-r--r-- | cmd-switch-client.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/cmd-switch-client.c b/cmd-switch-client.c index 22db9aba..e9cc046f 100644 --- a/cmd-switch-client.c +++ b/cmd-switch-client.c @@ -1,4 +1,4 @@ -/* $Id: cmd-switch-client.c,v 1.13 2008-12-10 20:25:41 nicm Exp $ */ +/* $Id: cmd-switch-client.c,v 1.14 2009-01-18 14:40:48 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -32,7 +32,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); +size_t cmd_switch_client_print(struct cmd *, char *, size_t); struct cmd_switch_client_data { char *name; @@ -145,7 +145,7 @@ cmd_switch_client_free(struct cmd *self) xfree(data); } -void +size_t cmd_switch_client_print(struct cmd *self, char *buf, size_t len) { struct cmd_switch_client_data *data = self->data; @@ -153,9 +153,10 @@ cmd_switch_client_print(struct cmd *self, char *buf, size_t len) off += xsnprintf(buf, len, "%s", self->entry->name); if (data == NULL) - return; + return (off); if (off < len && data->name != NULL) - off += xsnprintf(buf + off, len - off, " -c %s", data->name); + off += cmd_prarg(buf + off, len - off, " -c ", data->name); if (off < len && data->target != NULL) - off += xsnprintf(buf + off, len - off, " -t %s", data->target); + off += cmd_prarg(buf + off, len - off, " -t ", data->target); + return (off); } |