Commit 480da504 authored by Nils Goroll's avatar Nils Goroll

varnishhist -P: make graph boundary parameters optional

parent 50926acb
......@@ -549,9 +549,14 @@ main(int argc, char **argv)
"-P: '%s' is not a valid tag name",
optarg);
if (VSL_tagflags[match_tag])
VUT_Error(vut, 1,
"-P: '%s' is an unsafe or binary record",
optarg);
cli_p.prefix = colon + 1;
colon = strchr(colon + 1, ':');
colon = strchr(colon + 1, ':');
if (colon == NULL)
profile_error(optarg);
......@@ -559,20 +564,24 @@ main(int argc, char **argv)
if (*cli_p.prefix == '\0')
cli_p.prefix = NULL;
if (sscanf(colon + 1, "%d:%d:%d", &cli_p.field,
&cli_p.hist_low, &cli_p.hist_high) != 3)
if (sscanf(colon + 1, "%d", &cli_p.field) != 1)
profile_error(optarg);
if (VSL_tagflags[match_tag])
VUT_Error(vut, 1,
"-P: '%s' is an unsafe or binary record",
optarg);
cli_p.name = "custom";
cli_p.tag = match_tag;
cli_p.hist_low = -6;
cli_p.hist_high = 3;
profile = NULL;
active_profile = &cli_p;
colon = strchr(colon + 1, ':');
if (colon == NULL)
break;
if (sscanf(colon + 1, "%d:%d", &cli_p.hist_low,
&cli_p.hist_high) != 2)
profile_error(optarg);
break;
case 'B':
timebend = strtod(optarg, NULL);
......
......@@ -47,14 +47,15 @@
)
#define HIS_OPT_P \
VOPT("P:", "[-P <[cb:]tag:[prefix]:field_num:min:max>]", \
VOPT("P:", "[-P <[cb:]tag:[prefix]:field_num[:min:max]>]", \
"Custom profile definition", \
"Graph the given custom definition defined as: an optional" \
" (c)lient or (b)ackend filter (defaults to client), the" \
" tag we'll look for, a prefix to look for (can be empty," \
" but must be terminated by a colon) and the field number" \
" of the value we are interested in. min and max are the" \
" boundaries of the graph (these are power of ten)." \
" boundaries of the graph in power of ten and default to" \
" -6 and 3." \
)
#define HIS_OPT_B \
......
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