aboutsummaryrefslogtreecommitdiff
path: root/src/readconfig.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@Pirx.gnu.org.ua>2009-04-28 16:27:03 +0300
committerSergey Poznyakoff <gray@Pirx.gnu.org.ua>2009-04-28 16:27:03 +0300
commit20d7f1d7e051c6b021a3f5d088985a74c3370b29 (patch)
tree5c5dc1c1b401e055096b8ec216a6bd97eb76a520 /src/readconfig.c
parent29e4b3da0990aca9db232dc3ce0a57722ccf1cac (diff)
downloadtagr-20d7f1d7e051c6b021a3f5d088985a74c3370b29.tar.gz
tagr-20d7f1d7e051c6b021a3f5d088985a74c3370b29.tar.bz2
Store timestamps. Implement zero-unknown option.
* src/graph.c (draw_graph): Use timestamps from queue entries. Implement zero_unknown_option. * src/output.c: Store timestamps in traffic_history entries. * src/readconfig.c (cb_monitor, cb_server): Fix checks for empty ID. (tagr_kw): New keyword cut-out-fraction. (readconfig): Reset cut_out_fraction if it is < 1.0. * src/report.c: Print timestamps. * src/stat.c (cut_out_fraction): New variable. (ovf_t, overflow): Remove (spurious now) arguments. (interpolate, overflow, update_stats): Don't interpolate if time interval between this sample and the lastly taken one is greater than step * cut_out_fraction. * src/tagr.h (TAGR_CUT_OUT): New define.
Diffstat (limited to 'src/readconfig.c')
-rw-r--r--src/readconfig.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/readconfig.c b/src/readconfig.c
index 9eff4c7..e75cae4 100644
--- a/src/readconfig.c
+++ b/src/readconfig.c
@@ -89,10 +89,12 @@ cb_monitor (enum grecs_callback_command cmd,
switch (cmd)
{
case grecs_callback_section_begin:
- if (!value || value->type != GCONF_TYPE_STRING)
+ if (!value
+ || value->type != GCONF_TYPE_STRING
+ || value->v.string == NULL)
{
grecs_error (locus, 0, _("tag must be a string"));
- return 0;
+ return 1;
}
mon = xzalloc (sizeof (*mon));
mon->id = strdup (value->v.string);
@@ -399,10 +401,11 @@ cb_server (enum grecs_callback_command cmd,
switch (cmd)
{
case grecs_callback_section_begin:
- if (!value || value->type != GCONF_TYPE_STRING)
+ if (!value || value->type != GCONF_TYPE_STRING
+ || !value->v.string)
{
grecs_error (locus, 0, _("tag must be a string"));
- return 0;
+ return 1;
}
cfg = xzalloc (sizeof (*cfg));
cfg->id = value->v.string;
@@ -482,6 +485,9 @@ static struct grecs_keyword tagr_kw[] = {
{ "zero-unknown", NULL,
N_("Zero-out missing samples (not implemented)") /* FIXME */,
grecs_type_bool, &zero_unknown_option },
+ { "cut-out-fraction", N_("arg: double"), NULL, /* FIXME */
+ grecs_type_string, &cut_out_fraction, 0,
+ cb_double },
{ "fill-incoming", NULL, N_("Fill incoming graph"),
grecs_type_bool, &fill_incoming_option },
@@ -547,6 +553,8 @@ readconfig ()
rc = grecs_parse (configfile);
if (rc == 0)
mon_base = obstack_finish (&mon_stack);
+ if (cut_out_fraction < 1.0)
+ cut_out_fraction = TAGR_CUT_OUT;
return rc;
}

Return to:

Send suggestions and report system problems to the System administrator.