=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cmd-set-option.c,v retrieving revision 1.107 retrieving revision 1.108 diff -u -r1.107 -r1.108 --- src/usr.bin/tmux/cmd-set-option.c 2017/01/16 14:49:14 1.107 +++ src/usr.bin/tmux/cmd-set-option.c 2017/01/24 19:11:46 1.108 @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-set-option.c,v 1.107 2017/01/16 14:49:14 nicm Exp $ */ +/* $OpenBSD: cmd-set-option.c,v 1.108 2017/01/24 19:11:46 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -160,11 +160,17 @@ cmdq_error(item, "not an array: %s", args->argv[0]); return (CMD_RETURN_ERROR); } - } else { - if (*name != '@' && options_array_size(parent, NULL) != -1) { - cmdq_error(item, "is an array: %s", args->argv[0]); - return (CMD_RETURN_ERROR); + } else if (*name != '@' && options_array_size(parent, NULL) != -1) { + if (value == NULL) { + cmdq_error(item, "empty value"); + return (-1); } + if (o == NULL) + o = options_empty(oo, options_table_entry(parent)); + if (!args_has(args, 'a')) + options_array_clear(o); + options_array_assign(o, value); + return (CMD_RETURN_NORMAL); } /* With -o, check this option is not already set. */ @@ -197,7 +203,7 @@ else options_remove(o); } else - options_array_set(o, idx, NULL); + options_array_set(o, idx, NULL, 0); } else if (*name == '@') options_set_string(oo, name, args_has(args, 'a'), "%s", value); else if (idx == -1) { @@ -207,7 +213,7 @@ } else { if (o == NULL) o = options_empty(oo, options_table_entry(parent)); - if (options_array_set(o, idx, value) != 0) { + if (options_array_set(o, idx, value, 1) != 0) { cmdq_error(item, "invalid index: %s", args->argv[0]); return (CMD_RETURN_ERROR); }