Mercurial > dovecot > core-2.2
changeset 11792:243e01c2d7ba
doveadm director status: Print output using the print API, not printf.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 11 Jul 2010 20:26:15 +0100 |
parents | fec7013c628b |
children | 24e92489d7b7 |
files | src/doveadm/doveadm-director.c |
diffstat | 1 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doveadm/doveadm-director.c Sun Jul 11 19:42:48 2010 +0100 +++ b/src/doveadm/doveadm-director.c Sun Jul 11 20:26:15 2010 +0100 @@ -6,6 +6,7 @@ #include "write-full.h" #include "master-service.h" #include "doveadm.h" +#include "doveadm-print.h" #include <stdio.h> #include <stdlib.h> @@ -120,7 +121,13 @@ return; } - fprintf(stderr, "%-20s vhosts users\n", "mail server ip"); + doveadm_print_init(DOVEADM_PRINT_TYPE_TABLE); + doveadm_print_header_simple("mail server ip"); + doveadm_print_header("vhosts", "vhosts", + DOVEADM_PRINT_HEADER_FLAG_RIGHT_JUSTIFY); + doveadm_print_header("users", "vhosts", + DOVEADM_PRINT_HEADER_FLAG_RIGHT_JUSTIFY); + director_send(ctx, "HOST-LIST\n"); while ((line = i_stream_read_next_line(ctx->input)) != NULL) { if (*line == '\0') @@ -128,8 +135,9 @@ T_BEGIN { args = t_strsplit(line, "\t"); if (str_array_length(args) >= 3) { - printf("%-20s %6s %6s\n", - args[0], args[1], args[2]); + doveadm_print(args[0]); + doveadm_print(args[1]); + doveadm_print(args[2]); } } T_END; }