diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-01-24 19:11:47 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-01-24 19:11:47 +0000 |
commit | 38c599a96818f72492019b9f38af1421b37c2e65 (patch) | |
tree | fa082f2a0717481d28dcb8de815d0a39ae3cadc7 /usr.bin/tmux/cmd-show-options.c | |
parent | 4856937ff10a8987fbb03b4e1d9db5a2f7e2d300 (diff) |
If given an array option without an index either show or set all items,
and support -a for array options. Allow the separator for set to be
specified in the options table (will be used for backwards compatibility
later).
Diffstat (limited to 'usr.bin/tmux/cmd-show-options.c')
-rw-r--r-- | usr.bin/tmux/cmd-show-options.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.bin/tmux/cmd-show-options.c b/usr.bin/tmux/cmd-show-options.c index 06bf06f011f..caca53f911a 100644 --- a/usr.bin/tmux/cmd-show-options.c +++ b/usr.bin/tmux/cmd-show-options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-show-options.c,v 1.38 2017/01/18 10:08:05 nicm Exp $ */ +/* $OpenBSD: cmd-show-options.c,v 1.39 2017/01/24 19:11:46 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -92,11 +92,20 @@ cmd_show_options_print(struct cmd *self, struct cmdq_item *item, const char *name; const char *value; char *tmp, *escaped; + u_int size, i; if (idx != -1) { xasprintf(&tmp, "%s[%d]", options_name(o), idx); name = tmp; } else { + if (options_array_size(o, &size) != -1) { + for (i = 0; i < size; i++) { + if (options_array_get(o, i) == NULL) + continue; + cmd_show_options_print(self, item, o, i); + } + return; + } tmp = NULL; name = options_name(o); } |