diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-07-24 14:52:47 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-07-24 14:52:47 +0000 |
commit | 5a1a1066371328f9d53a9bc5e5c4c53acb26c2b2 (patch) | |
tree | b9b54a76352420ff03b31146ad0846e438332949 /cmd-unbind-key.c | |
parent | ce4eb6559e1aabb67e08a367a7c5e049e800c7ed (diff) | |
download | rtmux-5a1a1066371328f9d53a9bc5e5c4c53acb26c2b2.tar.gz rtmux-5a1a1066371328f9d53a9bc5e5c4c53acb26c2b2.tar.bz2 rtmux-5a1a1066371328f9d53a9bc5e5c4c53acb26c2b2.zip |
Permit commands to be bound to key presses without the prefix key first. The
new -n flag to bind-key and unbind-key sets or removes these bindings, and
list-key shows them in []s.
Diffstat (limited to 'cmd-unbind-key.c')
-rw-r--r-- | cmd-unbind-key.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cmd-unbind-key.c b/cmd-unbind-key.c index 7272bc77..0100e5a9 100644 --- a/cmd-unbind-key.c +++ b/cmd-unbind-key.c @@ -36,7 +36,7 @@ struct cmd_unbind_key_data { const struct cmd_entry cmd_unbind_key_entry = { "unbind-key", "unbind", - "key", + "[-n] key", 0, 0, NULL, cmd_unbind_key_parse, @@ -51,12 +51,15 @@ int cmd_unbind_key_parse(struct cmd *self, int argc, char **argv, char **cause) { struct cmd_unbind_key_data *data; - int opt; + int opt, no_prefix = 0; self->data = data = xmalloc(sizeof *data); - while ((opt = getopt(argc, argv, "")) != -1) { + while ((opt = getopt(argc, argv, "n")) != -1) { switch (opt) { + case 'n': + no_prefix = 1; + break; default: goto usage; } @@ -70,6 +73,8 @@ cmd_unbind_key_parse(struct cmd *self, int argc, char **argv, char **cause) xasprintf(cause, "unknown key: %s", argv[0]); goto error; } + if (!no_prefix) + data->key |= KEYC_PREFIX; return (0); |