From ecad8561259c0177d48f7cfb1bab3a8a5a6c209f Mon Sep 17 00:00:00 2001 From: Robert Kessl Date: Wed, 30 Jul 2014 14:30:30 +0200 Subject: [PATCH] tableprinter: update of tests and fix of parsing empty col opt --- ucw/table-test-2.c | 2 +- ucw/table.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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; -- 2.39.2