diff options
author | nicm <nicm> | 2019-03-15 21:54:47 +0000 |
---|---|---|
committer | nicm <nicm> | 2019-03-15 21:54:47 +0000 |
commit | e8b33af780d8b9622de422cbcd4f82a47ccd0c6e (patch) | |
tree | e7dee04f43125c667689296eecbbe507ddf0b237 /options.c | |
parent | 1d306e926a9f0cc6ab93f30857a8ca6d145ede83 (diff) | |
download | rtmux-e8b33af780d8b9622de422cbcd4f82a47ccd0c6e.tar.gz rtmux-e8b33af780d8b9622de422cbcd4f82a47ccd0c6e.tar.bz2 rtmux-e8b33af780d8b9622de422cbcd4f82a47ccd0c6e.zip |
Add a way to set individual defaults for an array option.
Diffstat (limited to 'options.c')
-rw-r--r-- | options.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -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); |