Commit 561b56ce authored by Federico G. Schwindt's avatar Federico G. Schwindt

Remove -w option from varnishstat

For continuous updates we can always use a shell loop.

Fixes #1760.
parent 99b85e7e
...@@ -252,8 +252,7 @@ usage(void) ...@@ -252,8 +252,7 @@ usage(void)
#define FMT " %-28s # %s\n" #define FMT " %-28s # %s\n"
fprintf(stderr, "usage: varnishstat " fprintf(stderr, "usage: varnishstat "
"[-1lV] [-f field] " "[-1lV] [-f field] "
VSC_n_USAGE " " VSC_n_USAGE "\n");
"[-w delay]\n");
fprintf(stderr, FMT, "-1", "Print the statistics to stdout."); fprintf(stderr, FMT, "-1", "Print the statistics to stdout.");
fprintf(stderr, FMT, "-f field", "Field inclusion glob"); fprintf(stderr, FMT, "-f field", "Field inclusion glob");
fprintf(stderr, FMT, "", fprintf(stderr, FMT, "",
...@@ -263,10 +262,6 @@ usage(void) ...@@ -263,10 +262,6 @@ usage(void)
fprintf(stderr, FMT, "-n varnish_name", fprintf(stderr, FMT, "-n varnish_name",
"The varnishd instance to get logs from"); "The varnishd instance to get logs from");
fprintf(stderr, FMT, "-V", "Display the version number and exit"); fprintf(stderr, FMT, "-V", "Display the version number and exit");
fprintf(stderr, FMT, "-w delay",
"Wait delay seconds between updates."
" Default is 1 second."
" Can also be be used with -1, -x or -j for repeated output.");
fprintf(stderr, FMT, "-x", fprintf(stderr, FMT, "-x",
"Print statistics to stdout as XML."); "Print statistics to stdout as XML.");
fprintf(stderr, FMT, "-j", fprintf(stderr, FMT, "-j",
...@@ -280,14 +275,14 @@ main(int argc, char * const *argv) ...@@ -280,14 +275,14 @@ main(int argc, char * const *argv)
{ {
int c; int c;
struct VSM_data *vd; struct VSM_data *vd;
double delay = 1.0, t_arg = 5.0, t_start = NAN; double t_arg = 5.0, t_start = NAN;
int once = 0, xml = 0, json = 0, do_repeat = 0, f_list = 0, curses = 0; int once = 0, xml = 0, json = 0, f_list = 0, curses = 0;
int i; int i;
vd = VSM_New(); vd = VSM_New();
AN(vd); AN(vd);
while ((c = getopt(argc, argv, VSC_ARGS "1f:lVw:xjt:")) != -1) { while ((c = getopt(argc, argv, VSC_ARGS "1f:lVxjt:")) != -1) {
switch (c) { switch (c) {
case '1': case '1':
once = 1; once = 1;
...@@ -313,14 +308,6 @@ main(int argc, char * const *argv) ...@@ -313,14 +308,6 @@ main(int argc, char * const *argv)
case 'V': case 'V':
VCS_Message("varnishstat"); VCS_Message("varnishstat");
exit(0); exit(0);
case 'w':
do_repeat = 1;
delay = VNUM(optarg);
if (isnan(delay)) {
fprintf(stderr, "-w: Syntax error");
exit(1);
}
break;
case 'x': case 'x':
xml = 1; xml = 1;
break; break;
...@@ -360,7 +347,7 @@ main(int argc, char * const *argv) ...@@ -360,7 +347,7 @@ main(int argc, char * const *argv)
fprintf(stderr, "%s\n", VSM_Error(vd)); fprintf(stderr, "%s\n", VSM_Error(vd));
exit(1); exit(1);
} }
do_curses(vd, delay); do_curses(vd, 1.0);
exit(0); exit(0);
} }
...@@ -369,24 +356,19 @@ main(int argc, char * const *argv) ...@@ -369,24 +356,19 @@ main(int argc, char * const *argv)
exit(1); exit(1);
} }
while (1) { if (xml)
if (xml) do_xml(vd);
do_xml(vd); else if (json)
else if (json) do_json(vd);
do_json(vd); else if (once)
else if (once) do_once(vd, VSC_Main(vd, NULL));
do_once(vd, VSC_Main(vd, NULL)); else if (f_list)
else if (f_list) list_fields(vd);
list_fields(vd); else
else assert(0);
assert(0);
if (!do_repeat)
break;
/* end of output block marker. */ /* end of output block marker. */
printf("\n"); printf("\n");
(void)usleep(delay * 1e6);
}
exit(0); exit(0);
} }
...@@ -15,7 +15,7 @@ Varnish Cache statistics ...@@ -15,7 +15,7 @@ Varnish Cache statistics
SYNOPSIS SYNOPSIS
======== ========
varnishstat [-1] [-x] [-j] [-f field] [-l] [-n varnish_name] [-N filename] [-V] [-w delay] varnishstat [-1] [-x] [-j] [-f field] [-l] [-n varnish_name] [-N filename] [-V]
.. TODO: autogenerate this synopsis like the others. .. TODO: autogenerate this synopsis like the others.
...@@ -64,10 +64,6 @@ The following options are available: ...@@ -64,10 +64,6 @@ The following options are available:
-V -V
Display the version number and exit. Display the version number and exit.
-w delay
Wait delay seconds between updates. The default is 1. Can
also be used with -1, -x or -j for repeated output.
-x -x
Displays the result as XML. Displays the result as XML.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment