[master] 24d426d Add code to dump VSL descriptions in RST format

Poul-Henning Kamp phk at varnish-cache.org
Mon Jul 2 23:08:40 CEST 2012


commit 24d426d569038afc81d0652fcb10ad4014f8ec2b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jul 2 21:08:15 2012 +0000

    Add code to dump VSL descriptions in RST format

diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index 18f1bb3..fd7c97f 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -70,6 +70,40 @@ struct vev_base		*mgt_evb;
 int			exit_status = 0;
 struct vsb		*vident;
 
+/*--------------------------------------------------------------------*/
+
+static void
+mgt_sltm(const char *tag, const char *sdesc, const char *ldesc)
+{
+	int i;
+
+	printf("\n%s\n", tag);
+	i = strlen(tag);
+	printf("%*.*s\n\n", i, i, "------------------------------------");
+	if (*ldesc != '\0')
+		printf("%s\n", ldesc);
+	else if (*sdesc != '\0')
+		printf("%s\n", sdesc);
+	else
+		printf("%s\n", "(description not yet written)");
+		
+}
+
+static void
+mgt_DumpRstVsl(void)
+{
+
+	printf(
+	    "\n.. The following is autogenerated output from "
+	    "varnishd -x dumprstvsl\n\n");
+
+#define SLTM(tag, sdesc, ldesc) mgt_sltm(#tag, sdesc, ldesc);
+#include "tbl/vsl_tags.h"
+#undef SLTM
+}
+
+/*--------------------------------------------------------------------*/
+
 static void
 build_vident(void)
 {
@@ -462,6 +496,10 @@ main(int argc, char * const *argv)
 				MCF_DumpRstParam();
 				exit (0);
 			}
+			if (!strcmp(optarg, "dumprstvsl")) {
+				mgt_DumpRstVsl();
+				exit (0);
+			}
 			usage();
 			break;
 		case 'w':
diff --git a/bin/varnishtest/tests/a00009.vtc b/bin/varnishtest/tests/a00009.vtc
index e488b3f..7a2cee2 100644
--- a/bin/varnishtest/tests/a00009.vtc
+++ b/bin/varnishtest/tests/a00009.vtc
@@ -2,3 +2,4 @@ varnishtest "Code coverage of VCL compiler and RSTdump"
 
 shell "cd ${topbuild}/bin/varnishd && ./varnishd -b 127.0.0.1:80 -C -n ${tmpdir} > /dev/null 2>&1"
 shell "cd ${topbuild}/bin/varnishd && ./varnishd -x dumprstparam > /dev/null 2>&1"
+shell "cd ${topbuild}/bin/varnishd && ./varnishd -x dumprstvsl > /dev/null 2>&1"



More information about the varnish-commit mailing list