summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/options.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2019-03-15 21:54:47 +0000
committernicm <nicm@openbsd.org>2019-03-15 21:54:47 +0000
commitd1d49da972f711c2a0a31de7c4f55da1dd3fe6fa (patch)
treef685d44b1ff4afeda876290cdec0c153a316061d /usr.bin/tmux/options.c
parentOnly accept one ICMPv6 and one route socket. (diff)
downloadwireguard-openbsd-d1d49da972f711c2a0a31de7c4f55da1dd3fe6fa.tar.xz
wireguard-openbsd-d1d49da972f711c2a0a31de7c4f55da1dd3fe6fa.zip
Add a way to set individual defaults for an array option.
Diffstat (limited to 'usr.bin/tmux/options.c')
-rw-r--r--usr.bin/tmux/options.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/usr.bin/tmux/options.c b/usr.bin/tmux/options.c
index c03253ad7ae..e91f801273a 100644
--- a/usr.bin/tmux/options.c
+++ b/usr.bin/tmux/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.37 2019/03/14 09:53:52 nicm Exp $ */
+/* $OpenBSD: options.c,v 1.38 2019/03/15 21:54:47 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -169,12 +169,17 @@ options_empty(struct options *oo, const struct options_table_entry *oe)
struct options_entry *
options_default(struct options *oo, const struct options_table_entry *oe)
{
- struct options_entry *o;
+ struct options_entry *o;
+ u_int i;
o = options_empty(oo, oe);
- if (oe->type == OPTIONS_TABLE_ARRAY)
- options_array_assign(o, oe->default_str);
- else if (oe->type == OPTIONS_TABLE_STRING)
+ if (oe->type == OPTIONS_TABLE_ARRAY) {
+ if (oe->default_arr != NULL) {
+ for (i = 0; oe->default_arr[i] != NULL; i++)
+ options_array_set(o, i, oe->default_arr[i], 0);
+ } else
+ options_array_assign(o, oe->default_str);
+ } else if (oe->type == OPTIONS_TABLE_STRING)
o->string = xstrdup(oe->default_str);
else if (oe->type == OPTIONS_TABLE_STYLE) {
style_set(&o->style, &grid_default_cell);