svn commit: samba r15131 - in branches/SAMBA_4_0/source/torture: .

jpeach at samba.org jpeach at samba.org
Wed Apr 19 03:06:51 GMT 2006


Author: jpeach
Date: 2006-04-19 03:06:50 +0000 (Wed, 19 Apr 2006)
New Revision: 15131

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15131

Log:
Tidy help output. When printing the list of tests, group them by prefix
to make it easier to see what tests are available.

Modified:
   branches/SAMBA_4_0/source/torture/smbtorture.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/smbtorture.c
===================================================================
--- branches/SAMBA_4_0/source/torture/smbtorture.c	2006-04-18 18:01:00 UTC (rev 15130)
+++ branches/SAMBA_4_0/source/torture/smbtorture.c	2006-04-19 03:06:50 UTC (rev 15131)
@@ -132,6 +132,7 @@
 static void usage(poptContext pc)
 {
 	struct torture_op *o;
+	char last_prefix[64];
 	int i;
 
 	poptPrintUsage(pc, stdout, 0);
@@ -177,23 +178,36 @@
 	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);
 }



More information about the samba-cvs mailing list