Get rid of trailing spaces which can be found after last column in tables.
Signed-off-by: Simon Kobyda <skobyda(a)redhat.com>
---
tools/vsh-table.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/vsh-table.c b/tools/vsh-table.c
index 9b4a34c1e6..fb656ffeb0 100644
--- a/tools/vsh-table.c
+++ b/tools/vsh-table.c
@@ -348,8 +348,10 @@ vshTableRowPrint(vshTableRowPtr row,
for (i = 0; i < row->ncells; i++) {
virBufferAsprintf(buf, " %s", row->cells[i]);
- for (j = 0; j < maxwidths[i] - widths[i] + 2; j++)
- virBufferAddChar(buf, ' ');
+ if (i < (row->ncells - 1)) {
+ for (j = 0; j < maxwidths[i] - widths[i] + 2; j++)
+ virBufferAddChar(buf, ' ');
+ }
}
virBufferAddChar(buf, '\n');
}
--
2.17.1