From: Timo Sirainen Date: Wed, 4 Jul 2018 13:16:36 +0000 (+0300) Subject: doveadm: Add doveadm_print_get_headers_count() X-Git-Tag: 2.3.9~1608 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed391e5afe56bc36ed74eb02fe99386f78daa445;p=thirdparty%2Fdovecot%2Fcore.git doveadm: Add doveadm_print_get_headers_count() Returns the number of headers added to printer. --- diff --git a/src/doveadm/doveadm-print.c b/src/doveadm/doveadm-print.c index 8af38b53ab..7cc7a59107 100644 --- a/src/doveadm/doveadm-print.c +++ b/src/doveadm/doveadm-print.c @@ -55,6 +55,11 @@ void doveadm_print_header_simple(const char *key_title) doveadm_print_header(key_title, key_title, 0); } +unsigned int doveadm_print_get_headers_count(void) +{ + return array_count(&ctx->headers); +} + static void doveadm_print_sticky_headers(void) { const struct doveadm_print_header_context *headers; diff --git a/src/doveadm/doveadm-print.h b/src/doveadm/doveadm-print.h index cf99aaca87..2585ed48af 100644 --- a/src/doveadm/doveadm-print.h +++ b/src/doveadm/doveadm-print.h @@ -27,6 +27,8 @@ bool doveadm_print_is_initialized(void); void doveadm_print_header(const char *key, const char *title, enum doveadm_print_header_flags flags); void doveadm_print_header_simple(const char *key_title); +unsigned int doveadm_print_get_headers_count(void); + void doveadm_print(const char *value); void doveadm_print_num(uintmax_t value); /* Stream for same field continues until len=0 */