ovsdb-client: Add blank line between tables in CSV, tabular output.
authorBen Pfaff <blp@nicira.com>
Fri, 12 Feb 2010 19:35:35 +0000 (11:35 -0800)
committerBen Pfaff <blp@nicira.com>
Mon, 15 Feb 2010 19:31:05 +0000 (11:31 -0800)
Adding a blank line makes the output easier to read when there are
multiple tables.

ovsdb/ovsdb-client.c
tests/ovsdb-monitor.at

index e6dee81..9dd8094 100644 (file)
@@ -434,9 +434,14 @@ table_print_table_line__(struct ds *line)
 static void
 table_print_table__(const struct table *table)
 {
+    static int n = 0;
     struct ds line = DS_EMPTY_INITIALIZER;
     size_t x, y;
 
+    if (n++ > 0) {
+        putchar('\n');
+    }
+
     if (output_headings) {
         for (x = 0; x < table->n_columns; x++) {
             const struct column *column = &table->columns[x];
@@ -590,8 +595,13 @@ table_print_csv_cell__(const char *content)
 static void
 table_print_csv__(const struct table *table)
 {
+    static int n = 0;
     size_t x, y;
 
+    if (n++ > 0) {
+        putchar('\n');
+    }
+
     if (table->caption) {
         puts(table->caption);
     }
index ad68740..16e2471 100644 (file)
@@ -61,6 +61,7 @@ OVSDB_CHECK_MONITOR([monitor insert into populated table],
        "row": {"number": 0, "name": "zero"}}]]]],
   [[row,action,name,number,_version
 <0>,initial,"""ten""",10,"[""uuid"",""<1>""]"
+
 row,action,name,number,_version
 <2>,insert,"""zero""",0,"[""uuid"",""<3>""]"
 ]])
@@ -78,6 +79,7 @@ OVSDB_CHECK_MONITOR([monitor delete],
        "where": [["number", "==", 10]]}]]]],
   [[row,action,name,number,_version
 <0>,initial,"""ten""",10,"[""uuid"",""<1>""]"
+
 row,action,name,number,_version
 <0>,delete,"""ten""",10,"[""uuid"",""<1>""]"
 ]])
@@ -96,6 +98,7 @@ OVSDB_CHECK_MONITOR([monitor row update],
        "row": {"name": "five plus five"}}]]]],
   [[row,action,name,number,_version
 <0>,initial,"""ten""",10,"[""uuid"",""<1>""]"
+
 row,action,name,number,_version
 <0>,old,"""ten""",,"[""uuid"",""<1>""]"
 ,new,"""five plus five""",10,"[""uuid"",""<2>""]"
@@ -119,6 +122,7 @@ OVSDB_CHECK_MONITOR([monitor no-op row updates],
        "row": {"number": 9, "name": "nine"}}]]]],
   [[row,action,name,number,_version
 <0>,initial,"""ten""",10,"[""uuid"",""<1>""]"
+
 row,action,name,number,_version
 <2>,insert,"""nine""",9,"[""uuid"",""<3>""]"
 ]])
@@ -141,6 +145,7 @@ OVSDB_CHECK_MONITOR([monitor insert-and-update transaction],
        "row": {"name": "three squared"}}]]]],
   [[row,action,name,number,_version
 <0>,initial,"""ten""",10,"[""uuid"",""<1>""]"
+
 row,action,name,number,_version
 <2>,insert,"""three squared""",9,"[""uuid"",""<3>""]"
 ]])
@@ -170,6 +175,7 @@ OVSDB_CHECK_MONITOR([monitor insert-update-and-delete transaction],
        "row": {"number": 7, "name": "seven"}}]]]],
   [[row,action,name,number,_version
 <0>,initial,"""ten""",10,"[""uuid"",""<1>""]"
+
 row,action,name,number,_version
 <2>,insert,"""seven""",7,"[""uuid"",""<3>""]"
 ]])