aboutsummaryrefslogtreecommitdiff
path: root/cmd-set-option.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2012-01-21 19:36:40 +0000
committerTiago Cunha <tcunha@gmx.com>2012-01-21 19:36:40 +0000
commita7b0b30bdd73f3a8d513fc69daf593174ee03145 (patch)
treedc44cb8d870c4786d9349be8ce123098d022d9f2 /cmd-set-option.c
parentd4c2a935f2039e00a7a7384fa0427a6126111611 (diff)
downloadrtmux-a7b0b30bdd73f3a8d513fc69daf593174ee03145.tar.gz
rtmux-a7b0b30bdd73f3a8d513fc69daf593174ee03145.tar.bz2
rtmux-a7b0b30bdd73f3a8d513fc69daf593174ee03145.zip
Sync OpenBSD patchset 1007:
Drop the ability to have a list of keys in the prefix in favour of two separate options, prefix and prefix2. This simplifies the code and gets rid the data options type which was only used for this one option. Also add a -2 flag to send-prefix to send the secondary prefix key, fixing a cause of minor irritation. People who want three prefix keys are out of luck :-).
Diffstat (limited to 'cmd-set-option.c')
-rw-r--r--cmd-set-option.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/cmd-set-option.c b/cmd-set-option.c
index c19f0235..5db70f63 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -45,7 +45,7 @@ struct options_entry *cmd_set_option_string(struct cmd *, struct cmd_ctx *,
struct options_entry *cmd_set_option_number(struct cmd *, struct cmd_ctx *,
const struct options_table_entry *, struct options *,
const char *);
-struct options_entry *cmd_set_option_keys(struct cmd *, struct cmd_ctx *,
+struct options_entry *cmd_set_option_key(struct cmd *, struct cmd_ctx *,
const struct options_table_entry *, struct options *,
const char *);
struct options_entry *cmd_set_option_colour(struct cmd *, struct cmd_ctx *,
@@ -236,8 +236,8 @@ cmd_set_option_set(struct cmd *self, struct cmd_ctx *ctx,
case OPTIONS_TABLE_NUMBER:
o = cmd_set_option_number(self, ctx, oe, oo, value);
break;
- case OPTIONS_TABLE_KEYS:
- o = cmd_set_option_keys(self, ctx, oe, oo, value);
+ case OPTIONS_TABLE_KEY:
+ o = cmd_set_option_key(self, ctx, oe, oo, value);
break;
case OPTIONS_TABLE_COLOUR:
o = cmd_set_option_colour(self, ctx, oe, oo, value);
@@ -298,31 +298,19 @@ cmd_set_option_number(unused struct cmd *self, struct cmd_ctx *ctx,
return (options_set_number(oo, oe->name, ll));
}
-/* Set a keys option. */
+/* Set a key option. */
struct options_entry *
-cmd_set_option_keys(unused struct cmd *self, struct cmd_ctx *ctx,
+cmd_set_option_key(unused struct cmd *self, struct cmd_ctx *ctx,
const struct options_table_entry *oe, struct options *oo, const char *value)
{
- struct keylist *keylist;
- char *copy, *ptr, *s;
- int key;
-
- keylist = xmalloc(sizeof *keylist);
- ARRAY_INIT(keylist);
-
- ptr = copy = xstrdup(value);
- while ((s = strsep(&ptr, ",")) != NULL) {
- if ((key = key_string_lookup_string(s)) == KEYC_NONE) {
- ctx->error(ctx, "unknown key: %s", s);
- xfree(copy);
- xfree(keylist);
- return (NULL);
- }
- ARRAY_ADD(keylist, key);
+ int key;
+
+ if ((key = key_string_lookup_string(value)) == KEYC_NONE) {
+ ctx->error(ctx, "bad key: %s", value);
+ return (NULL);
}
- xfree(copy);
- return (options_set_data(oo, oe->name, keylist, xfree));
+ return (options_set_number(oo, oe->name, key));
}
/* Set a colour option. */