diff --git a/bin/varnishd/mgt/mgt_cli.c b/bin/varnishd/mgt/mgt_cli.c
index 3b0c1a7..37791a2 100644
--- a/bin/varnishd/mgt/mgt_cli.c
+++ b/bin/varnishd/mgt/mgt_cli.c
@@ -79,6 +79,7 @@ mcf_banner(struct cli *cli, const char *const *av, void *priv)
 	VCLI_Out(cli, "-----------------------------\n");
 	VCLI_Out(cli, "Varnish Cache CLI 1.0\n");
 	VCLI_Out(cli, "-----------------------------\n");
+        VCLI_Out(cli, "%s\n", VCS_GetRevision());
 	VCLI_Out(cli, "%s\n", VSB_data(vident) + 1);
 	VCLI_Out(cli, "\n");
 	VCLI_Out(cli, "Type 'help' for command list.\n");
diff --git a/include/vcs.h b/include/vcs.h
index f764100..3e4b1a0 100644
--- a/include/vcs.h
+++ b/include/vcs.h
@@ -29,4 +29,5 @@
  */
 
 /* from libvarnish/version.c */
+char *VCS_GetRevision(void);
 void VCS_Message(const char *);
diff --git a/include/vsb.h b/include/vsb.h
index e17fe5b..0edf047 100644
--- a/include/vsb.h
+++ b/include/vsb.h
@@ -31,6 +31,7 @@
 #ifndef VSB_H_INCLUDED
 #define VSB_H_INCLUDED
 
+#include <sys/types.h>
 #include "vdef.h"
 
 /*
diff --git a/lib/libvarnish/version.c b/lib/libvarnish/version.c
index 2220a69..fe230ca 100644
--- a/lib/libvarnish/version.c
+++ b/lib/libvarnish/version.c
@@ -35,12 +35,28 @@
 
 #include "vcs.h"
 #include "vcs_version.h"
+#include "vsb.h"
+
+static struct vsb *vrevision;
+
+char *
+VCS_GetRevision()
+{
+    if (vrevision == NULL) {
+        vrevision = VSB_new(NULL, NULL, sizeof(PACKAGE_TARNAME)
+                            + sizeof(PACKAGE_VERSION) + sizeof(VCS_Version)
+                            + sizeof("- revision ") + 1, VSB_FIXEDLEN);
+        VSB_printf(vrevision, "%s-%s revision %s", PACKAGE_TARNAME,
+                   PACKAGE_VERSION, VCS_Version);
+        VSB_finish(vrevision);
+    }
+    return VSB_data(vrevision);
+}
 
 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_GetRevision());
 	fprintf(stderr, "Copyright (c) 2006 Verdens Gang AS\n");
 	fprintf(stderr, "Copyright (c) 2006-2011 Varnish Software AS\n");
 }
