From: Robert Kessl Date: Wed, 30 Jul 2014 12:30:30 +0000 (+0200) Subject: tableprinter: update of tests and fix of parsing empty col opt X-Git-Tag: v6.1~3^2~16 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=ecad8561259c0177d48f7cfb1bab3a8a5a6c209f;p=libucw.git tableprinter: update of tests and fix of parsing empty col opt --- diff --git a/ucw/table-test-2.c b/ucw/table-test-2.c index 854cfd87..01ba0c7d 100644 --- a/ucw/table-test-2.c +++ b/ucw/table-test-2.c @@ -127,7 +127,7 @@ static void do_test3(void) tbl = table_init(&test_tbl2); table_set_col_order_by_name(tbl, ""); - err = table_set_option_value(tbl, "cols", "size[MB,TB,KB],size[MB],size[GB],size[TB],size[auto],ts[datetime],ts[],size[MB,KB"); + err = table_set_option_value(tbl, "cols", "size[MB,TB,KB],size[MB],size[GB],size[TB],size[auto],ts[,,datetime,timestamp],ts[],size[MB,KB"); bprintf(out, "Error occured: %s\n", err); table_cleanup(tbl); diff --git a/ucw/table.c b/ucw/table.c index c48eb8ba..25a01d8d 100644 --- a/ucw/table.c +++ b/ucw/table.c @@ -250,11 +250,12 @@ static char **table_parse_col_arg2(char *col_def) if(*next == 0) break; *next = 0; next++; - *GARY_PUSH(result) = col_opt; + if(*col_opt) + *GARY_PUSH(result) = col_opt; col_opt = next; } - if(strlen(col_opt) > 0) + if(*col_opt) *GARY_PUSH(result) = col_opt; return result;