#include "common.h"
#include "plugin.h"
#include "configfile.h"
-#include "network.h"
#define ESCAPE_NULL(str) ((str) == NULL ? "(null)" : (str))
{"BaseDir", NULL, PKGLOCALSTATEDIR},
{"PIDFile", NULL, PIDFILE},
{"Hostname", NULL, NULL},
- {"Interval", NULL, "10"}
+ {"Interval", NULL, "10"},
+ {"ReadThreads", NULL, "5"},
+ {"TypesDB", NULL, PLUGINDIR"/types.db"} /* FIXME: Configure path */
};
static int cf_global_options_num = STATIC_ARRAY_LEN (cf_global_options);
{
if (ci->values_num != 1)
return (-1);
- if (ci->values[0].type != OCONFIG_TYPE_STRING)
- return (-1);
+ if (ci->values[0].type == OCONFIG_TYPE_STRING)
+ return (global_option_set (ci->key, ci->values[0].value.string));
+ else if (ci->values[0].type == OCONFIG_TYPE_NUMBER)
+ {
+ char tmp[128];
+ snprintf (tmp, sizeof (tmp), "%lf", ci->values[0].value.number);
+ tmp[127] = '\0';
+ return (global_option_set (ci->key, tmp));
+ }
- return (global_option_set (ci->key, ci->values[0].value.string));
-}
+ return (-1);
+} /* int dispatch_global_option */
static int dispatch_value_plugindir (const oconfig_item_t *ci)
{
if (i >= cf_global_options_num)
return (-1);
- if (cf_global_options[i].value != NULL)
- free (cf_global_options[i].value);
+ sfree (cf_global_options[i].value);
if (value != NULL)
cf_global_options[i].value = strdup (value);
free (this);
break;
}
-}
+} /* void cf_unregister */
void cf_register (const char *type,
int (*callback) (const char *, const char *),