From fee07cb8ef8d7c8f86903d970527ce8a7b2f6408 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Thu, 20 Jul 2000 14:42:31 +0000 Subject: [PATCH] (rtbl_format): avoid printing an empty row at the end git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8721 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/roken/rtbl.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/roken/rtbl.c b/lib/roken/rtbl.c index 80e3bb1a2..ae351c92f 100644 --- a/lib/roken/rtbl.c +++ b/lib/roken/rtbl.c @@ -195,7 +195,6 @@ rtbl_format (rtbl_t table, FILE * f) { int i, j; - for (i = 0; i < table->num_columns; i++) column_compute_width (table->columns[i]); for (i = 0; i < table->num_columns; i++) { @@ -209,6 +208,17 @@ rtbl_format (rtbl_t table, FILE * f) for (j = 0;; j++) { int flag = 0; + for (i = 0; flag == 0 && i < table->num_columns; ++i) { + struct column_data *c = table->columns[i]; + + if (c->num_rows > j) { + ++flag; + break; + } + } + if (flag == 0) + break; + for (i = 0; i < table->num_columns; i++) { int w; struct column_data *c = table->columns[i]; @@ -220,13 +230,9 @@ rtbl_format (rtbl_t table, FILE * f) fprintf (f, "%s", get_column_prefix (table, c)); if (c->num_rows <= j) fprintf (f, "%*s", w, ""); - else { + else fprintf (f, "%*s", w, c->rows[j].data); - flag++; - } } - if (flag == 0) - break; fprintf (f, "\n"); } return 0;