summaryrefslogtreecommitdiffstats
path: root/cmd-send-keys.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-01-18 14:40:48 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-01-18 14:40:48 +0000
commita15f8fc4a66420615d237313c6a01fcf532c52a2 (patch)
tree751d858639e20ae413ec907f7cf3215c06e3820d /cmd-send-keys.c
parentc4d5989a4ef03db0477446ee004ef431be268286 (diff)
Support command sequences separated by " ; ". Also clean up command printing.
Diffstat (limited to 'cmd-send-keys.c')
-rw-r--r--cmd-send-keys.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/cmd-send-keys.c b/cmd-send-keys.c
index afded43c..95e73f02 100644
--- a/cmd-send-keys.c
+++ b/cmd-send-keys.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-send-keys.c,v 1.16 2009-01-11 23:31:46 nicm Exp $ */
+/* $Id: cmd-send-keys.c,v 1.17 2009-01-18 14:40:48 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -31,7 +31,7 @@ void cmd_send_keys_exec(struct cmd *, struct cmd_ctx *);
void cmd_send_keys_send(struct cmd *, struct buffer *);
void cmd_send_keys_recv(struct cmd *, struct buffer *);
void cmd_send_keys_free(struct cmd *);
-void cmd_send_keys_print(struct cmd *, char *, size_t);
+size_t cmd_send_keys_print(struct cmd *, char *, size_t);
struct cmd_send_keys_data {
char *target;
@@ -160,7 +160,7 @@ cmd_send_keys_free(struct cmd *self)
xfree(data);
}
-void
+size_t
cmd_send_keys_print(struct cmd *self, char *buf, size_t len)
{
struct cmd_send_keys_data *data = self->data;
@@ -169,9 +169,9 @@ cmd_send_keys_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->target != NULL)
- off += xsnprintf(buf + off, len - off, " -t %s", data->target);
+ off += cmd_prarg(buf + off, len - off, " -t ", data->target);
if (off < len && data->idx != -1)
off += xsnprintf(buf + off, len - off, " -i %d", data->idx);
@@ -181,4 +181,5 @@ cmd_send_keys_print(struct cmd *self, char *buf, size_t len)
off += xsnprintf(buf + off,
len - off, " %s", key_string_lookup_key(data->keys[i]));
}
+ return (off);
}