dovecot-2.0: doveadm director status: Print output using the pri...

dovecot at dovecot.org dovecot at dovecot.org
Sun Jul 11 22:26:19 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/243e01c2d7ba
changeset: 11792:243e01c2d7ba
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Jul 11 20:26:15 2010 +0100
description:
doveadm director status: Print output using the print API, not printf.

diffstat:

 src/doveadm/doveadm-director.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r fec7013c628b -r 243e01c2d7ba src/doveadm/doveadm-director.c
--- 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;
 	}


More information about the dovecot-cvs mailing list