dovecot-2.0-sslstream: doveadm who: reformatted command output

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 13 02:55:34 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0-sslstream/rev/c316e7198ae3
changeset: 10167:c316e7198ae3
user:      Pascal Volk <user at localhost.localdomain.org>
date:      Fri Oct 23 13:58:26 2009 +0000
description:
doveadm who: reformatted command output

diffstat:

1 file changed, 13 insertions(+), 13 deletions(-)
src/doveadm/doveadm-who.c |   26 +++++++++++++-------------

diffs (64 lines):

diff -r 2800d96a37c6 -r c316e7198ae3 src/doveadm/doveadm-who.c
--- a/src/doveadm/doveadm-who.c	Thu Oct 22 23:07:36 2009 -0400
+++ b/src/doveadm/doveadm-who.c	Fri Oct 23 13:58:26 2009 +0000
@@ -185,7 +185,7 @@ static void who_print(struct who_context
 	struct hash_iterate_context *iter;
 	void *key, *value;
 
-	fprintf(stderr, "%-30s  # proto (ips) (pids)\n", "username");
+	fprintf(stderr, "%-30s  # proto\t(pids)\t(ips)\n", "username");
 
 	iter = hash_table_iterate_init(ctx->users);
 	while (hash_table_iterate(iter, &key, &value)) {
@@ -201,6 +201,15 @@ static void who_print(struct who_context
 		       user->connection_count, user->service);
 
 		printf("(");
+		array_foreach(&user->pids, pid) T_BEGIN {
+			if (first)
+				first = FALSE;
+			else
+				printf(" ");
+			printf("%ld", (long)*pid);
+		} T_END;
+		printf(") (");
+		first = TRUE;
 		array_foreach(&user->ips, ip) T_BEGIN {
 			if (first)
 				first = FALSE;
@@ -208,15 +217,6 @@ static void who_print(struct who_context
 				printf(" ");
 			printf("%s", net_ip2addr(ip));
 		} T_END;
-		printf(") (");
-		first = TRUE;
-		array_foreach(&user->pids, pid) T_BEGIN {
-			if (first)
-				first = FALSE;
-			else
-				printf(" ");
-			printf("%ld", (long)*pid);
-		} T_END;
 		printf(")\n");
 	};
 	hash_table_iterate_deinit(&iter);
@@ -246,8 +246,8 @@ static void who_print_line(struct who_co
 		return;
 
 	for (i = 0; i < line->refcount; i++) T_BEGIN {
-		printf("%-30s %-15s %-5s %ld\n", line->username,
-		       net_ip2addr(&line->ip), line->service, (long)line->pid);
+		printf("%-30s %-5s\t%ld\t%-15s\n", line->username,
+		       line->service, (long)line->pid, net_ip2addr(&line->ip));
 	} T_END;
 }
 
@@ -297,7 +297,7 @@ static void cmd_who(int argc, char *argv
 		who_lookup(&ctx, who_aggregate_line);
 		who_print(&ctx);
 	} else {
-		fprintf(stderr, "%-30s %-15s proto pid\n", "username", "ip");
+		fprintf(stderr, "%-30s proto\tpid\t%-15s\n", "username", "ip");
 		who_lookup(&ctx, who_print_line);
 	}
 


More information about the dovecot-cvs mailing list