dovecot-2.2: doveadm: Table formatter now hides the titles if al...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Mar 24 18:14:29 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/210282ae46e1
changeset: 16103:210282ae46e1
user: Timo Sirainen <tss at iki.fi>
date: Sun Mar 24 18:13:53 2013 +0200
description:
doveadm: Table formatter now hides the titles if all of them are marked hidden.
diffstat:
src/doveadm/doveadm-print-table.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diffs (43 lines):
diff -r 1b269672e33b -r 210282ae46e1 src/doveadm/doveadm-print-table.c
--- a/src/doveadm/doveadm-print-table.c Sun Mar 24 17:48:17 2013 +0200
+++ b/src/doveadm/doveadm-print-table.c Sun Mar 24 18:13:53 2013 +0200
@@ -135,16 +135,20 @@
}
}
-static void doveadm_buffer_flush(void)
+static void doveadm_print_headers(void)
{
const struct doveadm_print_table_header *headers;
- const char *const *valuep;
unsigned int i, count;
- doveadm_calc_header_length();
-
headers = array_get(&ctx->headers, &count);
+ /* if all headers are hidden, don't print any of them */
for (i = 0; i < count; i++) {
+ if ((headers[i].flags & DOVEADM_PRINT_HEADER_FLAG_HIDE_TITLE) == 0)
+ break;
+ }
+ if (i == count)
+ return;
+ for (; i < count; i++) {
if (i > 0) fprintf(stderr, " ");
if ((headers[i].flags &
@@ -157,6 +161,14 @@
}
}
fprintf(stderr, "\n");
+}
+
+static void doveadm_buffer_flush(void)
+{
+ const char *const *valuep;
+
+ doveadm_calc_header_length();
+ doveadm_print_headers();
array_foreach(&ctx->buffered_values, valuep)
doveadm_print_next(*valuep);
More information about the dovecot-cvs
mailing list