aboutsummaryrefslogtreecommitdiff
path: root/cmd-set-option.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2015-06-04 16:01:07 +0100
committerThomas Adam <thomas@xteddy.org>2015-06-04 16:01:07 +0100
commit83a70172a4a12ee9fa069b381172ddbf75c92ad1 (patch)
treee62163eec50cbb4c253e56ec677221034f87daee /cmd-set-option.c
parent02e348c069b9f49b44344281276b81fe537b3c8b (diff)
parent4a6c06d6a981d05c5ab3dbc7a365ff740fbb7feb (diff)
downloadrtmux-83a70172a4a12ee9fa069b381172ddbf75c92ad1.tar.gz
rtmux-83a70172a4a12ee9fa069b381172ddbf75c92ad1.tar.bz2
rtmux-83a70172a4a12ee9fa069b381172ddbf75c92ad1.zip
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-set-option.c')
-rw-r--r--cmd-set-option.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/cmd-set-option.c b/cmd-set-option.c
index 83d31b93..77c7d7c2 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -266,16 +266,25 @@ cmd_set_option_unset(struct cmd *self, struct cmd_q *cmdq,
{
struct args *args = self->args;
- if (args_has(args, 'g')) {
- cmdq_error(cmdq, "can't unset global option: %s", oe->name);
- return (-1);
- }
if (value != NULL) {
cmdq_error(cmdq, "value passed to unset option: %s", oe->name);
return (-1);
}
- options_remove(oo, oe->name);
+ if (args_has(args, 'g') || oo == &global_options) {
+ switch (oe->type) {
+ case OPTIONS_TABLE_STRING:
+ options_set_string(oo, oe->name, "%s", oe->default_str);
+ break;
+ case OPTIONS_TABLE_STYLE:
+ options_set_style(oo, oe->name, oe->default_str, 0);
+ break;
+ default:
+ options_set_number(oo, oe->name, oe->default_num);
+ break;
+ }
+ } else
+ options_remove(oo, oe->name);
return (0);
}