[master] 1b72563 Move varnish-counters man page.

Lasse Karstensen lkarsten at varnish-software.com
Mon Dec 21 14:27:46 CET 2015


commit 1b72563e9c0a50afa5613bad5344c37e75f2c2c8
Author: Lasse Karstensen <lkarsten at varnish-software.com>
Date:   Mon Dec 21 14:24:14 2015 +0100

    Move varnish-counters man page.
    
    To get this into the normal Sphinx build, move it to bin/varnishstat/
    (where it feels like it belongs the most), and use our normal build flow for man
    pages.

diff --git a/.gitignore b/.gitignore
index 5795c63..0cfaa04 100644
--- a/.gitignore
+++ b/.gitignore
@@ -76,7 +76,6 @@ cscope.*out
 
 
 # Man-files and binaries
-/man/vsc2rst
 /man/*.1
 /man/*.3
 /man/*.7
@@ -90,6 +89,7 @@ cscope.*out
 /bin/varnishncsa/varnishncsa
 /bin/varnishreplay/varnishreplay
 /bin/varnishstat/varnishstat
+/bin/varnishstat/vsc2rst
 /bin/varnishtest/varnishtest
 /bin/varnishtop/varnishtop
 
diff --git a/bin/varnishstat/Makefile.am b/bin/varnishstat/Makefile.am
index 664131d..a276444 100644
--- a/bin/varnishstat/Makefile.am
+++ b/bin/varnishstat/Makefile.am
@@ -19,3 +19,6 @@ varnishstat_LDADD = \
 	$(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \
 	$(top_builddir)/lib/libvarnishapi/libvarnishapi.la \
 	@CURSES_LIB@ ${RT_LIBS} ${LIBM} ${PTHREAD_LIBS}
+
+noinst_PROGRAMS = vsc2rst
+vsc2rst_SOURCES = vsc2rst.c $(top_srcdir)/include/tbl/vsc_fields.h
diff --git a/bin/varnishstat/vsc2rst.c b/bin/varnishstat/vsc2rst.c
new file mode 100644
index 0000000..3358db4
--- /dev/null
+++ b/bin/varnishstat/vsc2rst.c
@@ -0,0 +1,109 @@
+/*-
+ * Copyright (c) 2011-2015 Varnish Software AS
+ * All rights reserved.
+ *
+ * Author: Tollef Fog Heen <tfheen at varnish-software.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+
+#define VSC_LEVEL_F(v,l,e,d)		\
+	static const char VSC_level_##v[] = l;
+#include "tbl/vsc_levels.h"
+#undef VSC_LEVEL_F
+
+#define P(x, ...)			\
+	printf(x "\n", ##__VA_ARGS__)
+#define VSC_LEVEL_F(v,l,e,d)		\
+	printf("%s – %s\n\t%s\n\n", l, e, d);
+#define VSC_F(n, t, l, s, f, v, d, e)	\
+	printf("%s – %s (%s)\n\t%s\n\n", #n, e, VSC_level_##v, d);
+
+int main(int argc, char **argv)
+{
+	(void)argc;
+	(void)argv;
+	P("COUNTER LEVELS");
+	P("==============");
+	P("");
+#include "tbl/vsc_levels.h"
+
+	P("");
+	P("MAIN COUNTERS (MAIN.*)");
+	P("======================");
+	P("");
+#include "tbl/vsc_f_main.h"
+
+	P("MANAGEMENT PROCESS COUNTERS (MGT.*)");
+	P("===================================");
+	P("");
+#define VSC_DO_MGT
+#include "tbl/vsc_fields.h"
+#undef VSC_DO_MGT
+
+	P("");
+	P("PER MEMORY POOL COUNTERS (MEMPOOL.*)");
+	P("====================================");
+	P("");
+#define VSC_DO_MEMPOOL
+#include "tbl/vsc_fields.h"
+#undef VSC_DO_MEMPOOL
+
+	P("");
+	P("PER MALLOC STORAGE COUNTERS (SMA.*)");
+	P("===================================");
+	P("");
+#define VSC_DO_SMA
+#include "tbl/vsc_fields.h"
+#undef  VSC_DO_SMA
+
+	P("");
+	P("PER FILE STORAGE COUNTERS (SMF.*)");
+	P("=================================");
+	P("");
+#define VSC_DO_SMF
+#include "tbl/vsc_fields.h"
+#undef VSC_DO_SMF
+
+	P("");
+	P("PER BACKEND COUNTERS (VBE.*)");
+	P("============================");
+	P("");
+#define VSC_DO_VBE
+#include "tbl/vsc_fields.h"
+#undef VSC_DO_VBE
+
+	P("");
+	P("LOCK COUNTERS (LCK.*)");
+	P("=====================");
+	P("");
+#define VSC_DO_LCK
+#include "tbl/vsc_fields.h"
+#undef VSC_DO_LCK
+
+	return (0);
+}
diff --git a/doc/sphinx/Makefile.am b/doc/sphinx/Makefile.am
index fbfe06b..b17ec99 100644
--- a/doc/sphinx/Makefile.am
+++ b/doc/sphinx/Makefile.am
@@ -128,6 +128,10 @@ include/params.rst: $(top_builddir)/bin/varnishd/varnishd
 	$(top_builddir)/bin/varnishd/varnishd -x dumprstparam > include/params.rst
 BUILT_SOURCES = include/params.rst
 
+include/counters.rst: $(top_builddir)/bin/varnishstat/vsc2rst
+	$(top_builddir)/bin/varnishstat/vsc2rst > $@
+BUILT_SOURCES += include/counters.rst
+
 # XXX add varnishstat here when it's been _opt2rst'ed
 
 include/varnishncsa_options.rst: $(top_builddir)/bin/varnishncsa/varnishncsa_opt2rst
diff --git a/doc/sphinx/reference/index.rst b/doc/sphinx/reference/index.rst
index e787b4e..603d1a0 100644
--- a/doc/sphinx/reference/index.rst
+++ b/doc/sphinx/reference/index.rst
@@ -23,6 +23,7 @@ The Varnish Reference Manual
 	vmod_std.generated.rst
 	vmod_directors.generated.rst
 	directors.rst
+	varnish-counters.rst
 	vsl.rst
 	vsl-query.rst
 
diff --git a/doc/sphinx/reference/varnish-counters.rst b/doc/sphinx/reference/varnish-counters.rst
new file mode 100644
index 0000000..781eeaa
--- /dev/null
+++ b/doc/sphinx/reference/varnish-counters.rst
@@ -0,0 +1,21 @@
+.. _varnish-counters(7):
+
+================
+varnish-counters
+================
+
+---------------------------------
+Varnish counter field definitions
+---------------------------------
+
+:Manual section: 7
+
+
+.. include:: ../include/counters.rst
+
+
+AUTHORS
+=======
+
+This man page was written by Lasse Karstensen, using content from vsc2rst
+written by Tollef Fog Heen.
diff --git a/man/Makefile.am b/man/Makefile.am
index 82f5471..35a8c52 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -1,11 +1,5 @@
 #
 
-noinst_PROGRAMS = vsc2rst
-vsc2rst_SOURCES = vsc2rst.c \
-	$(top_srcdir)/include/tbl/vsc_fields.h
-
-AM_CPPFLAGS = -I$(top_srcdir)/include
-
 dist_man_MANS = \
 	varnish-cli.7 \
 	varnish-counters.7 \
@@ -30,8 +24,8 @@ RST2ANY_FLAGS = --halt=2
 varnish-cli.7: $(top_srcdir)/doc/sphinx/reference/varnish-cli.rst
 	${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnish-cli.rst $@
 
-varnish-counters.7: vsc2rst
-	./vsc2rst | ${RST2MAN} $(RST2ANY_FLAGS) - $@
+varnish-counters.7: $(top_srcdir)/doc/sphinx/reference/varnish-counters.rst
+	${RST2MAN} $(RST2ANY_FLAGS) $(top_srcdir)/doc/sphinx/reference/varnish-counters.rst $@
 
 vcl.7: $(top_srcdir)/doc/sphinx/reference/vcl.rst \
 	$(top_srcdir)/bin/varnishd/builtin.vcl
diff --git a/man/vsc2rst.c b/man/vsc2rst.c
deleted file mode 100644
index 11c3d2a..0000000
--- a/man/vsc2rst.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*-
- * Copyright (c) 2011-2015 Varnish Software AS
- * All rights reserved.
- *
- * Author: Tollef Fog Heen <tfheen at varnish-software.com>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include "config.h"
-
-#include <stdio.h>
-
-#define VSC_LEVEL_F(v,l,e,d)		\
-	static const char VSC_level_##v[] = l;
-#include "tbl/vsc_levels.h"
-#undef VSC_LEVEL_F
-
-#define P(x, ...)			\
-	printf(x "\n", ##__VA_ARGS__)
-#define VSC_LEVEL_F(v,l,e,d)		\
-	printf("%s – %s\n\t%s\n\n", l, e, d);
-#define VSC_F(n, t, l, s, f, v, d, e)	\
-	printf("%s – %s (%s)\n\t%s\n\n", #n, e, VSC_level_##v, d);
-
-int main(int argc, char **argv)
-{
-	(void)argc;
-	(void)argv;
-	P(".. _varnish-counters(7): ");
-	P("");
-	P("================");
-	P("varnish-counters");
-	P("================");
-	P("");
-
-	P("---------------------------------");
-	P("Varnish counter field definitions");
-	P("---------------------------------");
-	P("");
-
-	P(":Manual section: 7");
-	P("");
-
-	P("COUNTER LEVELS");
-	P("==============");
-	P("");
-#include "tbl/vsc_levels.h"
-
-	P("");
-	P("MAIN COUNTERS (MAIN.*)");
-	P("======================");
-	P("");
-#include "tbl/vsc_f_main.h"
-
-	P("MANAGEMENT PROCESS COUNTERS (MGT.*)");
-	P("===================================");
-	P("");
-#define VSC_DO_MGT
-#include "tbl/vsc_fields.h"
-#undef VSC_DO_MGT
-
-	P("");
-	P("PER MEMORY POOL COUNTERS (MEMPOOL.*)");
-	P("====================================");
-	P("");
-#define VSC_DO_MEMPOOL
-#include "tbl/vsc_fields.h"
-#undef VSC_DO_MEMPOOL
-
-	P("");
-	P("PER MALLOC STORAGE COUNTERS (SMA.*)");
-	P("===================================");
-	P("");
-#define VSC_DO_SMA
-#include "tbl/vsc_fields.h"
-#undef  VSC_DO_SMA
-
-	P("");
-	P("PER FILE STORAGE COUNTERS (SMF.*)");
-	P("=================================");
-	P("");
-#define VSC_DO_SMF
-#include "tbl/vsc_fields.h"
-#undef VSC_DO_SMF
-
-	P("");
-	P("PER BACKEND COUNTERS (VBE.*)");
-	P("============================");
-	P("");
-#define VSC_DO_VBE
-#include "tbl/vsc_fields.h"
-#undef VSC_DO_VBE
-
-	P("");
-	P("LOCK COUNTERS (LCK.*)");
-	P("=====================");
-	P("");
-#define VSC_DO_LCK
-#include "tbl/vsc_fields.h"
-#undef VSC_DO_LCK
-
-	P("");
-	P("COPYRIGHT");
-	P("=========");
-	P("This document is licensed under the same licence as Varnish");
-	P("itself. See LICENCE for details.");
-	P("");
-	P("* Copyright (c) 2006 Verdens Gang AS");
-	P("* Copyright (c) 2006-2015 Varnish Software AS");
-	return (0);
-}



More information about the varnish-commit mailing list