Final missing print function.

pull/1/head
Nicholas Marriott 2008-06-05 21:54:47 +00:00
parent 0b9b873a55
commit 741f8967b4
3 changed files with 27 additions and 6 deletions

6
arg.c
View File

@ -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>
@ -79,7 +79,7 @@ arg_parse_client(const char *arg)
if (arg2[n - 1] == ':')
arg2[n - 1] = '\0';
/* Try and lookup the client name. */
/* Try and look up the client name. */
c = arg_lookup_client(arg2);
xfree(arg2);
return (c);
@ -154,7 +154,7 @@ arg_parse_window(const char *arg, struct session **s, int *idx)
return (0);
}
/* If missing, try as an index, else lookup immediately. */
/* If missing, try as an index, else look up immediately. */
if (ptr == NULL) {
*idx = strtonum(arg2, 0, INT_MAX, &errstr);
if (errstr == NULL) {

View File

@ -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);
}
}

View File

@ -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);