Skip to content

Commit

Permalink
ovsdb-client: Add blank line between tables in CSV, tabular output.
Browse files Browse the repository at this point in the history
Adding a blank line makes the output easier to read when there are
multiple tables.
  • Loading branch information
blp committed Feb 15, 2010
1 parent 25c269e commit e512548
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ovsdb/ovsdb-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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);
}
Expand Down
6 changes: 6 additions & 0 deletions tests/ovsdb-monitor.at
Original file line number Diff line number Diff line change
Expand Up @@ -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>""]"
]])
Expand All @@ -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>""]"
]])
Expand All @@ -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>""]"
Expand All @@ -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>""]"
]])
Expand All @@ -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>""]"
]])
Expand Down Expand Up @@ -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>""]"
]])
Expand Down

0 comments on commit e512548

Please sign in to comment.