summaryrefslogtreecommitdiffstats
path: root/cmd-send-keys.c
diff options
context:
space:
mode:
authornicm <nicm>2008-06-05 17:12:09 +0000
committernicm <nicm>2008-06-05 17:12:09 +0000
commit8ec72d5b7f72d1559d31388c92ed624420527ebb (patch)
treed74902e21bee4572745b107d570cd89cdfe9f5ad /cmd-send-keys.c
parent29b63e060bff090b98425e953af089cedaea8ef1 (diff)
downloadtmux-old-8ec72d5b7f72d1559d31388c92ed624420527ebb.tar.gz
tmux-old-8ec72d5b7f72d1559d31388c92ed624420527ebb.tar.bz2
tmux-old-8ec72d5b7f72d1559d31388c92ed624420527ebb.zip
Print for the less easy commands.
Diffstat (limited to 'cmd-send-keys.c')
-rw-r--r--cmd-send-keys.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/cmd-send-keys.c b/cmd-send-keys.c
index 18708f03..13d80d38 100644
--- a/cmd-send-keys.c
+++ b/cmd-send-keys.c
@@ -32,6 +32,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);
struct cmd_send_keys_data {
char *cname;
@@ -51,7 +52,7 @@ const struct cmd_entry cmd_send_keys_entry = {
cmd_send_keys_recv,
cmd_send_keys_free,
NULL,
- NULL
+ cmd_send_keys_print
};
int
@@ -181,3 +182,27 @@ cmd_send_keys_free(struct cmd *self)
xfree(data->sname);
xfree(data);
}
+
+void
+cmd_send_keys_print(struct cmd *self, char *buf, size_t len)
+{
+ struct cmd_send_keys_data *data = self->data;
+ size_t off = 0;
+ u_int i;
+
+ off += xsnprintf(buf, len, "%s", self->entry->name);
+ if (data == NULL)
+ return;
+ off += xsnprintf(buf + off, len - off, " -c %s", data->cname);
+ if (off < len && data->sname != NULL)
+ off += xsnprintf(buf + off, len - off, " -s %s", data->sname);
+ if (off < len && data->idx != -1)
+ off += xsnprintf(buf + off, len - off, " -i %d", data->idx);
+
+ for (i = 0; i < data->nkeys; i++) {
+ if (off >= len)
+ break;
+ off += xsnprintf(buf + off,
+ len - off, " %s", key_string_lookup_key(data->keys[i]));
+ }
+}