From 83a557dfad713c0ab30c071ae4cdab0713337928 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Mon, 9 Nov 2015 18:01:47 +0100 Subject: [PATCH] smbstatus: align tree connect header and output Align output and use timestring() instead of time_to_asc(). The latter calls asctime() which forces a \n into the time string. Signed-off-by: Ralph Boehme Reviewed-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source3/utils/status.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/source3/utils/status.c b/source3/utils/status.c index 41438af2157..f92c84fd40a 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -302,6 +302,7 @@ static int traverse_connections(const struct connections_key *key, { TALLOC_CTX *mem_ctx = (TALLOC_CTX *)private_data; struct server_id_buf tmp; + char *timestr = NULL; if (crec->cnum == TID_FIELD_INVALID) return 0; @@ -311,10 +312,16 @@ static int traverse_connections(const struct connections_key *key, return 0; } - d_printf("%-10s %s %-12s %s", + timestr = timestring(mem_ctx, crec->start); + if (timestr == NULL) { + return -1; + } + + d_printf("%-12s %-7s %-13s %-32s\n", crec->servicename, server_id_str_buf(crec->pid, &tmp), - crec->machine, - time_to_asc(crec->start)); + crec->machine, timestr); + + TALLOC_FREE(timestr); return 0; } @@ -578,8 +585,8 @@ int main(int argc, const char *argv[]) goto done; } - d_printf("\nService pid machine Connected at\n"); - d_printf("-------------------------------------------------------\n"); + d_printf("\n%-12s %-7s %-13s %-32s\n", "Service", "pid", "machine", "Connected at"); + d_printf("-------------------------------------------------------------\n"); connections_forall_read(traverse_connections, frame); -- 2.11.4.GIT