mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-23 16:43:11 +01:00
Final missing print function.
This commit is contained in:
parent
0b9b873a55
commit
741f8967b4
2
arg.c
2
arg.c
@ -1,4 +1,4 @@
|
||||
/* $Id: arg.c,v 1.1 2008-06-05 21:25:00 nicm Exp $ */
|
||||
/* $Id: arg.c,v 1.2 2008-06-05 21:54:47 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-bind-key.c,v 1.14 2008-06-05 21:25:00 nicm Exp $ */
|
||||
/* $Id: cmd-bind-key.c,v 1.15 2008-06-05 21:54:47 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -31,6 +31,7 @@ void cmd_bind_key_exec(struct cmd *, struct cmd_ctx *);
|
||||
void cmd_bind_key_send(struct cmd *, struct buffer *);
|
||||
void cmd_bind_key_recv(struct cmd *, struct buffer *);
|
||||
void cmd_bind_key_free(struct cmd *);
|
||||
void cmd_bind_key_print(struct cmd *, char *, size_t);
|
||||
|
||||
struct cmd_bind_key_data {
|
||||
int key;
|
||||
@ -47,7 +48,7 @@ const struct cmd_entry cmd_bind_key_entry = {
|
||||
cmd_bind_key_send,
|
||||
cmd_bind_key_recv,
|
||||
cmd_bind_key_free,
|
||||
NULL /* XXX */
|
||||
cmd_bind_key_print
|
||||
};
|
||||
|
||||
int
|
||||
@ -133,3 +134,22 @@ cmd_bind_key_free(struct cmd *self)
|
||||
cmd_free(data->cmd);
|
||||
xfree(data);
|
||||
}
|
||||
|
||||
void
|
||||
cmd_bind_key_print(struct cmd *self, char *buf, size_t len)
|
||||
{
|
||||
struct cmd_bind_key_data *data = self->data;
|
||||
size_t off = 0;
|
||||
|
||||
off += xsnprintf(buf, len, "%s", self->entry->name);
|
||||
if (data == NULL)
|
||||
return;
|
||||
if (off < len) {
|
||||
off += xsnprintf(buf + off,
|
||||
len - off, " %s", key_string_lookup_key(data->key));
|
||||
}
|
||||
if (off < len && data->cmd != NULL) {
|
||||
off += xsnprintf(buf + off, len - off, " ");
|
||||
data->cmd->entry->print(data->cmd, buf + off, len - off);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-send-keys.c,v 1.10 2008-06-05 21:25:00 nicm Exp $ */
|
||||
/* $Id: cmd-send-keys.c,v 1.11 2008-06-05 21:54:47 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -169,6 +169,7 @@ cmd_send_keys_print(struct cmd *self, char *buf, size_t len)
|
||||
off += xsnprintf(buf, len, "%s", self->entry->name);
|
||||
if (data == NULL)
|
||||
return;
|
||||
if (off < len && data->target != NULL)
|
||||
off += xsnprintf(buf + off, len - off, " -t %s", data->target);
|
||||
if (off < len && data->idx != -1)
|
||||
off += xsnprintf(buf + off, len - off, " -i %d", data->idx);
|
||||
|
Loading…
Reference in New Issue
Block a user