fprintf(stderr, " %-28s # %s\n", "",
" -s file,<dir_or_file>,<size>");
fprintf(stderr, " %-28s # %s\n", "-t", "Default TTL");
+ fprintf(stderr, " %-28s # %s\n", "-V", "version");
fprintf(stderr, " %-28s # %s\n", "-w int[,int[,int]]",
"Number of worker threads");
fprintf(stderr, " %-28s # %s\n", "",
heritage.wthread_timeout = 10;
heritage.mem_workspace = 4096;
- while ((o = getopt(argc, argv, "b:df:h:p:s:t:w:")) != -1)
+ while ((o = getopt(argc, argv, "b:df:h:p:s:t:Vw:")) != -1)
switch (o) {
case 'b':
bflag = optarg;
case 't':
heritage.default_ttl = strtoul(optarg, NULL, 0);
break;
+ case 'V':
+ varnish_version("varnishd");
+ exit(0);
case 'w':
tackle_warg(optarg);
break;
/*--------------------------------------------------------------------*/
static void
-Usage(void)
+usage(void)
{
- fprintf(stderr, "Usage: varnishlog [-o] [-w file] [-r file]\n");
- exit(2);
+ fprintf(stderr, "usage: varnishlog [-oV] [-w file] [-r file]\n");
+ exit(1);
}
int
vd = VSL_New();
- while ((c = getopt(argc, argv, VSL_ARGS "how:")) != -1) {
+ while ((c = getopt(argc, argv, VSL_ARGS "hoVw:")) != -1) {
i = VSL_Arg(vd, c, optarg);
if (i < 0)
exit (1);
case 'o':
o_flag = 1;
break;
+ case 'V':
+ varnish_version("varnishlog");
+ exit(0);
case 'w':
w_opt = optarg;
break;
default:
- Usage();
+ usage();
}
}
exit (1);
if (o_flag && w_opt != NULL)
- Usage();
+ usage();
if (w_opt != NULL) {
if (!strcmp(w_opt, "-"))
varnishncsa_LDADD = \
$(top_builddir)/lib/libvarnish/libvarnish.la \
+ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \
$(top_builddir)/lib/libvarnishapi/libvarnishapi.la
/*--------------------------------------------------------------------*/
static void
-Usage(void)
+usage(void)
{
- fprintf(stderr, "Usage: varnishlogfile [-w file] [-r file]\n");
- exit(2);
+ fprintf(stderr, "usage: varnishncsa [-V] [-w file] [-r file]\n");
+ exit(1);
}
int
if (i > 0)
continue;
switch (c) {
+ case 'V':
+ varnish_version("varnishncsa");
+ exit(0);
case 'w':
w_opt = optarg;
break;
default:
- Usage();
+ usage();
}
}
varnishstat_CFLAGS = -include config.h
varnishstat_LDADD = \
- -lcurses \
- $(top_builddir)/lib/libvarnishapi/libvarnishapi.la
+ $(top_builddir)/lib/libvarnish/libvarnish.la \
+ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \
+ -lcurses
}
}
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: varnishstat [-cV]\n");
+ exit(1);
+}
+
int
main(int argc, char **argv)
{
VSL_stats = VSL_OpenStats();
- while ((c = getopt(argc, argv, "c")) != -1) {
+ while ((c = getopt(argc, argv, "cV")) != -1) {
switch (c) {
case 'c':
c_flag = 1;
break;
+ case 'V':
+ varnish_version("varnishstat");
+ exit(0);
default:
- fprintf(stderr, "Usage: varnishstat [-c]\n");
- exit (2);
+ usage();
}
}
/*--------------------------------------------------------------------*/
static void
-Usage(void)
+usage(void)
{
- fprintf(stderr, "Usage: varnishtop\n");
- exit(2);
+ fprintf(stderr, "usage: varnishtop [-1V]\n");
+ exit(1);
}
static void
vd = VSL_New();
- while ((c = getopt(argc, argv, VSL_ARGS "1")) != -1) {
+ while ((c = getopt(argc, argv, VSL_ARGS "1V")) != -1) {
i = VSL_Arg(vd, c, optarg);
if (i < 0)
exit (1);
case '1':
one_flag = 1;
break;
+ case 'V':
+ varnish_version("varnishtop");
+ exit(0);
default:
- Usage();
+ usage();
}
}
time_t TIM_parse(const char *p);
#endif
+/* from libvarnish/version.c */
+void varnish_version(const char *);
+
/* Assert zero return value */
#define AZ(foo) do { assert((foo) == 0); } while (0)
cli.c \
cli_common.c \
time.c \
+ version.c \
vsb.c
libvarnish_la_CFLAGS = -include config.h
--- /dev/null
+/*
+ * $Id$
+ *
+ * Display a standardized version message.
+ */
+
+#include <stdio.h>
+
+#include "libvarnish.h"
+
+void
+varnish_version(const char *progname)
+{
+ fprintf(stderr, "%s (%s-%s)\n", progname,
+ PACKAGE_TARNAME, PACKAGE_VERSION);
+ fprintf(stderr, "Copyright (c) 2006 Linpro AS / Verdens Gang AS\n");
+}