diff options
author | James Peach <jpeach@samba.org> | 2006-04-19 03:06:50 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:04:10 -0500 |
commit | 4d81335115ad477db289d8e169698af57d07e0fe (patch) | |
tree | d39e1c24140ccad1a0f8db21a7113e50e1dc4e24 /source4 | |
parent | 73b385d3c42d203dac8df7f5300df81d4f8fdebc (diff) | |
download | samba-4d81335115ad477db289d8e169698af57d07e0fe.tar.gz samba-4d81335115ad477db289d8e169698af57d07e0fe.tar.bz2 samba-4d81335115ad477db289d8e169698af57d07e0fe.zip |
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)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/smbtorture.c | 26 |
1 files changed, 20 insertions, 6 deletions
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); } |