1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

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)
This commit is contained in:
James Peach 2006-04-19 03:06:50 +00:00 committed by Gerald (Jerry) Carter
parent 73b385d3c4
commit 4d81335115

View File

@ -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);
}