diff options
author | Olivier Perret <Olivier.Perret@mailbox.org> | 2018-01-21 14:39:29 +0100 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2018-01-22 23:17:26 -0800 |
commit | 70b2be3cf7cececd1c4114f21e80189360643a52 (patch) | |
tree | 10c408911055c1867ce52c19d58faa171de8b9d8 /options | |
parent | 0cd501dac10b0b2e5b57f2786efb0171c49f8a9c (diff) |
m_option: add print callback to color type
This lets scripts query the value of 'background' and similar properties
Diffstat (limited to 'options')
-rw-r--r-- | options/m_option.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/options/m_option.c b/options/m_option.c index 71744e1646..7ce137ba53 100644 --- a/options/m_option.c +++ b/options/m_option.c @@ -1830,10 +1830,17 @@ exit: return is_help ? M_OPT_EXIT : M_OPT_INVALID; } +static char *print_color(const m_option_t *opt, const void *val) +{ + const struct m_color *c = val; + return talloc_asprintf(NULL, "#%02X%02X%02X%02X", c->a, c->r, c->g, c->b); +} + const m_option_type_t m_option_type_color = { .name = "Color", .size = sizeof(struct m_color), .parse = parse_color, + .print = print_color, .copy = copy_opt, }; |