From: Robert Kessl Date: Tue, 22 Jul 2014 11:08:18 +0000 (+0200) Subject: tableprinter: header option now parsed by xtypes X-Git-Tag: v6.1~3^2~68 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=89679c303a41b2a40012c4ad49d6de2b0306b1af;p=libucw.git tableprinter: header option now parsed by xtypes --- diff --git a/ucw/table.c b/ucw/table.c index 74ca5296..0c0294e5 100644 --- a/ucw/table.c +++ b/ucw/table.c @@ -387,12 +387,13 @@ const char *table_set_option_value(struct table *tbl, const char *key, const cha // Options with a value if(value) { if(strcmp(key, "header") == 0) { - if(value[1] != 0) - return mp_printf(tbl->pool, "Invalid header parameter: '%s' has invalid value: '%s'.", key, value); - uint tmp = value[0] - '0'; - if(tmp > 1) + bool tmp; + const char *err = xt_bool.parse(value, &tmp, tbl->pool); + if(err) return mp_printf(tbl->pool, "Invalid header parameter: '%s' has invalid value: '%s'.", key, value); + tbl->print_header = tmp; + return NULL; } else if(strcmp(key, "cols") == 0) { return table_set_col_order_by_name(tbl, value);