[ovs-dev] [PATCH 07/14] ovsdb-client: Add blank line between tables in CSV, tabular output.

Ben Pfaff blp at nicira.com
Fri Feb 12 11:37:27 PST 2010


Adding a blank line makes the output easier to read when there are
multiple tables.
---
 ovsdb/ovsdb-client.c   |   10 ++++++++++
 tests/ovsdb-monitor.at |    6 ++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c
index 52a2b6b..6838cf5 100644
--- a/ovsdb/ovsdb-client.c
+++ b/ovsdb/ovsdb-client.c
@@ -432,9 +432,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];
@@ -588,8 +593,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);
     }
diff --git a/tests/ovsdb-monitor.at b/tests/ovsdb-monitor.at
index ad68740..16e2471 100644
--- a/tests/ovsdb-monitor.at
+++ b/tests/ovsdb-monitor.at
@@ -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>""]"
 ]])
-- 
1.6.6.1





More information about the dev mailing list