From: Ben Pfaff Date: Fri, 12 Feb 2010 19:35:35 +0000 (-0800) Subject: ovsdb-client: Add blank line between tables in CSV, tabular output. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5125481cf98eebb4ff49c7881410493629c9ec0;p=openvswitch ovsdb-client: Add blank line between tables in CSV, tabular output. Adding a blank line makes the output easier to read when there are multiple tables. --- diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c index e6dee819..9dd80943 100644 --- a/ovsdb/ovsdb-client.c +++ b/ovsdb/ovsdb-client.c @@ -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); } diff --git a/tests/ovsdb-monitor.at b/tests/ovsdb-monitor.at index ad687408..16e24719 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>""]" ]])