[3.0] c209326 Add the version identifier to the CLI banner.

Tollef Fog Heen tfheen at varnish-cache.org
Mon Apr 22 13:26:59 CEST 2013


commit c209326d4c5cf3090b052a861a13b39b4085295f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Aug 6 08:12:13 2012 +0000

    Add the version identifier to the CLI banner.
    
    Inspired by:	patch from geoff

diff --git a/bin/varnishd/mgt_cli.c b/bin/varnishd/mgt_cli.c
index e31f3f8..7b27e98 100644
--- a/bin/varnishd/mgt_cli.c
+++ b/bin/varnishd/mgt_cli.c
@@ -80,6 +80,7 @@ mcf_banner(struct cli *cli, const char *const *av, void *priv)
 	VCLI_Out(cli, "Varnish Cache CLI 1.0\n");
 	VCLI_Out(cli, "-----------------------------\n");
 	VCLI_Out(cli, "%s\n", VSB_data(vident) + 1);
+	VCLI_Out(cli, "%s\n", VCS_version);
 	VCLI_Out(cli, "\n");
 	VCLI_Out(cli, "Type 'help' for command list.\n");
 	VCLI_Out(cli, "Type 'quit' to close CLI session.\n");
diff --git a/include/libvarnish.h b/include/libvarnish.h
index a4fd542..b457d02 100644
--- a/include/libvarnish.h
+++ b/include/libvarnish.h
@@ -104,6 +104,7 @@ struct timespec TIM_timespec(double t);
 struct timeval TIM_timeval(double t);
 
 /* from libvarnish/version.c */
+extern const char *VCS_version;
 void VCS_Message(const char *);
 
 /* from libvarnish/vtmpfile.c */
diff --git a/lib/libvarnish/version.c b/lib/libvarnish/version.c
index 014eda4..3427ee7 100644
--- a/lib/libvarnish/version.c
+++ b/lib/libvarnish/version.c
@@ -36,11 +36,13 @@
 #include "libvarnish.h"
 #include "vcs_version.h"
 
+const char *VCS_version =
+    PACKAGE_TARNAME "-" PACKAGE_VERSION " revision " VCS_Version;
+
 void
 VCS_Message(const char *progname)
 {
-	fprintf(stderr, "%s (%s-%s revision %s)\n", progname,
-		PACKAGE_TARNAME, PACKAGE_VERSION, VCS_Version);
+	fprintf(stderr, "%s (%s)\n", progname, VCS_version);
 	fprintf(stderr, "Copyright (c) 2006 Verdens Gang AS\n");
 	fprintf(stderr, "Copyright (c) 2006-2011 Varnish Software AS\n");
 }



More information about the varnish-commit mailing list