diff options
author | Thomas Adam <thomas@xteddy.org> | 2020-06-16 10:01:21 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2020-06-16 10:01:21 +0100 |
commit | eb448daa1a07fa25a9928791cdc8411da271a9bc (patch) | |
tree | df8e81d6e1895384dc83f59f536c51ad1af1baf6 /options.c | |
parent | 824efe7be47ff534d57da1ab66c3d0dfde86992d (diff) | |
parent | 1bf9555e4f1ad19e1e6f97ede6fb19808ff1c267 (diff) | |
download | rtmux-eb448daa1a07fa25a9928791cdc8411da271a9bc.tar.gz rtmux-eb448daa1a07fa25a9928791cdc8411da271a9bc.tar.bz2 rtmux-eb448daa1a07fa25a9928791cdc8411da271a9bc.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'options.c')
-rw-r--r-- | options.c | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -66,6 +66,7 @@ struct options { }; static struct options_entry *options_add(struct options *, const char *); +static void options_remove(struct options_entry *); #define OPTIONS_IS_STRING(o) \ ((o)->tableentry == NULL || \ @@ -315,7 +316,7 @@ options_add(struct options *oo, const char *name) return (o); } -void +static void options_remove(struct options_entry *o) { struct options *oo = o->owner; @@ -1106,3 +1107,21 @@ options_push_changes(const char *name) server_redraw_client(loop); } } + +int +options_remove_or_default(struct options_entry *o, int idx, char **cause) +{ + struct options *oo = o->owner; + + if (idx == -1) { + if (o->tableentry != NULL && + (oo == global_options || + oo == global_s_options || + oo == global_w_options)) + options_default(oo, o->tableentry); + else + options_remove(o); + } else if (options_array_set(o, idx, NULL, 0, cause) != 0) + return (-1); + return (0); +} |