From 4865a1ded730cde7ecf0e6d10ed11fad17c2f8d5 Mon Sep 17 00:00:00 2001 From: Pascal Volk Date: Fri, 23 Oct 2009 13:58:26 +0000 Subject: [PATCH] doveadm who: reformatted command output --HG-- branch : HEAD --- src/doveadm/doveadm-who.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/doveadm/doveadm-who.c b/src/doveadm/doveadm-who.c index e1af804dd9..4fc5ef6b32 100644 --- a/src/doveadm/doveadm-who.c +++ b/src/doveadm/doveadm-who.c @@ -185,7 +185,7 @@ static void who_print(struct who_context *ctx) 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,21 +201,21 @@ static void who_print(struct who_context *ctx) user->connection_count, user->service); printf("("); - array_foreach(&user->ips, ip) T_BEGIN { + array_foreach(&user->pids, pid) T_BEGIN { if (first) first = FALSE; else printf(" "); - printf("%s", net_ip2addr(ip)); + printf("%ld", (long)*pid); } T_END; printf(") ("); first = TRUE; - array_foreach(&user->pids, pid) T_BEGIN { + array_foreach(&user->ips, ip) T_BEGIN { if (first) first = FALSE; else printf(" "); - printf("%ld", (long)*pid); + printf("%s", net_ip2addr(ip)); } T_END; printf(")\n"); }; @@ -246,8 +246,8 @@ static void who_print_line(struct who_context *ctx, 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); } -- 2.47.3