version 1.12, 2010/10/20 18:20:36 |
version 1.13, 2011/01/04 00:42:46 |
|
|
|
|
const struct cmd_entry cmd_list_keys_entry = { |
const struct cmd_entry cmd_list_keys_entry = { |
"list-keys", "lsk", |
"list-keys", "lsk", |
|
"t:", 0, 0, |
"[-t key-table]", |
"[-t key-table]", |
0, "", |
0, |
cmd_target_init, |
NULL, |
cmd_target_parse, |
NULL, |
cmd_list_keys_exec, |
cmd_list_keys_exec |
cmd_target_free, |
|
cmd_target_print |
|
}; |
}; |
|
|
int |
int |
cmd_list_keys_exec(struct cmd *self, struct cmd_ctx *ctx) |
cmd_list_keys_exec(struct cmd *self, struct cmd_ctx *ctx) |
{ |
{ |
struct cmd_target_data *data = self->data; |
struct args *args = self->args; |
struct key_binding *bd; |
struct key_binding *bd; |
const char *key; |
const char *key; |
char tmp[BUFSIZ]; |
char tmp[BUFSIZ]; |
size_t used; |
size_t used; |
int width, keywidth; |
int width, keywidth; |
|
|
if (data->target != NULL) |
if (args_has(args, 't')) |
return (cmd_list_keys_table(self, ctx)); |
return (cmd_list_keys_table(self, ctx)); |
|
|
width = 0; |
width = 0; |
|
|
int |
int |
cmd_list_keys_table(struct cmd *self, struct cmd_ctx *ctx) |
cmd_list_keys_table(struct cmd *self, struct cmd_ctx *ctx) |
{ |
{ |
struct cmd_target_data *data = self->data; |
struct args *args = self->args; |
|
const char *tablename; |
const struct mode_key_table *mtab; |
const struct mode_key_table *mtab; |
struct mode_key_binding *mbind; |
struct mode_key_binding *mbind; |
const char *key, *cmdstr, *mode; |
const char *key, *cmdstr, *mode; |
int width, keywidth; |
int width, keywidth; |
|
|
if ((mtab = mode_key_findtable(data->target)) == NULL) { |
tablename = args_get(args, 't'); |
ctx->error(ctx, "unknown key table: %s", data->target); |
if ((mtab = mode_key_findtable(tablename)) == NULL) { |
|
ctx->error(ctx, "unknown key table: %s", tablename); |
return (-1); |
return (-1); |
} |
} |
|
|