]> mj.ucw.cz Git - libucw.git/commitdiff
tableprinter: update of tests and fix of parsing empty col opt
authorRobert Kessl <kesslr@centrum.cz>
Wed, 30 Jul 2014 12:30:30 +0000 (14:30 +0200)
committerRobert Kessl <kesslr@centrum.cz>
Wed, 30 Jul 2014 12:30:30 +0000 (14:30 +0200)
ucw/table-test-2.c
ucw/table.c

index 854cfd87b14514a64b0fc0bef225719b6444b52d..01ba0c7d9652a19ca73f918c2ec674032699f90f 100644 (file)
@@ -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);
 
index c48eb8ba3428c18a39dcce3da22ea621f26ed464..25a01d8db055d72c7f362817972d6cefae9cf0aa 100644 (file)
@@ -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;