From 4d81335115ad477db289d8e169698af57d07e0fe Mon Sep 17 00:00:00 2001 From: James Peach Date: Wed, 19 Apr 2006 03:06:50 +0000 Subject: r15131: Tidy help output. When printing the list of tests, group them by prefix to make it easier to see what tests are available. (This used to be commit f15010ccb37f75a4bb86306cec223093b000058e) --- source4/torture/smbtorture.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'source4') diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index 984d6ed27a..22e69120df 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -132,6 +132,7 @@ static void parse_dns(const char *dns) static void usage(poptContext pc) { struct torture_op *o; + char last_prefix[64]; int i; poptPrintUsage(pc, stdout, 0); @@ -177,23 +178,36 @@ static void usage(poptContext pc) printf(" ncacn_ip_tcp:myserver[1024]\n"); printf(" ncacn_ip_tcp:myserver[1024,sign,seal]\n\n"); - printf("The unc format is:\n\n"); + printf("The UNC format is:\n\n"); - printf(" //server/share\n\n"); + printf(" //server/share\n\n"); - printf("tests are:\n"); + printf("Tests are:"); i = 0; + last_prefix[0] = '\0'; for (o = torture_ops; o; o = o->next) { - if (i + strlen(o->name) >= MAX_COLS) { - printf("\n"); + const char * sep; + + if ((sep = strchr(o->name, '-'))) { + if (strncmp(o->name, last_prefix, sep - o->name) != 0) { + strncpy(last_prefix, o->name, + MIN(sizeof(last_prefix), + sep - o->name)); + printf("\n\n "); + i = 0; + } + } + + if (i + strlen(o->name) >= (MAX_COLS - 2)) { + printf("\n "); i = 0; } i+=printf("%s ", o->name); } printf("\n\n"); - printf("default test is ALL\n"); + printf("The default test is ALL.\n"); exit(1); } -- cgit