/**
* collectd - src/configfile.c
- * Copyright (C) 2005 Florian octo Forster
+ * Copyright (C) 2005,2006 Florian octo Forster
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
#define ERR_NEEDS_ARG "Section `%s' needs an argument.\n"
#define ERR_NEEDS_SECTION "`%s' can only be used within a section.\n"
-#ifdef HAVE_LIBRRD
extern int operating_mode;
-#else
-static int operating_mode = MODE_CLIENT;
-#endif
typedef struct cf_callback
{
static cf_mode_item_t cf_mode_list[] =
{
{"TimeToLive", NULL, MODE_CLIENT },
- {"PIDFile", NULL, MODE_CLIENT | MODE_SERVER | MODE_LOCAL},
- {"DataDir", NULL, MODE_CLIENT | MODE_SERVER | MODE_LOCAL},
- {"LogFile", NULL, MODE_CLIENT | MODE_SERVER | MODE_LOCAL}
+ {"PIDFile", NULL, MODE_CLIENT | MODE_SERVER | MODE_LOCAL | MODE_LOG },
+ {"DataDir", NULL, MODE_CLIENT | MODE_SERVER | MODE_LOCAL | MODE_LOG },
+ {"LogFile", NULL, MODE_CLIENT | MODE_SERVER | MODE_LOCAL | MODE_LOG }
};
static int cf_mode_num = 4;
if ((cf_cb = cf_search (type)) == NULL)
{
- syslog (LOG_WARNING, "Plugin `%s' did not register a callback.\n", type);
+ syslog (LOG_WARNING, "Plugin `%s' did not register a callback.", type);
return (-1);
}
}
if (i >= cf_cb->keys_num)
- syslog (LOG_WARNING, "Plugin `%s' did not register for value `%s'.\n", type, key);
+ syslog (LOG_WARNING, "Plugin `%s' did not register for value `%s'.", type, key);
free (key);
free (value);
+ DBG ("return (%i)", ret);
+
return (ret);
}
if (strcasecmp (value, "Client") == 0)
operating_mode = MODE_CLIENT;
+#if HAVE_LIBRRD
else if (strcasecmp (value, "Server") == 0)
operating_mode = MODE_SERVER;
else if (strcasecmp (value, "Local") == 0)
operating_mode = MODE_LOCAL;
+#endif
+ else if (strcasecmp (value, "Log") == 0)
+ operating_mode = MODE_LOG;
else
{
syslog (LOG_ERR, "Invalid value for config option `Mode': `%s'", value);