summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 92d8409)
raw | patch | inline | side by side (parent: 92d8409)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 23 Nov 2008 18:06:53 +0000 (19:06 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 23 Nov 2008 18:06:53 +0000 (19:06 +0100) |
src/target_set.c | patch | blob | history |
diff --git a/src/target_set.c b/src/target_set.c
index 3a4220efe6ed5245d37e0b9f4ab3df30357b9302..e328da31a5327bd5541b2abcca1954744d38ca1f 100644 (file)
--- a/src/target_set.c
+++ b/src/target_set.c
char *host;
char *plugin;
char *plugin_instance;
- char *type;
+ /* char *type; */
char *type_instance;
};
typedef struct ts_data_s ts_data_t;
} /* }}} char *ts_strdup */
static int ts_config_add_string (char **dest, /* {{{ */
- const oconfig_item_t *ci)
+ const oconfig_item_t *ci, int may_be_empty)
{
char *temp;
return (-1);
}
+ if ((!may_be_empty) && (ci->values[0].value.string[0] == 0))
+ {
+ ERROR ("Target `set': The `%s' option does not accept empty strings.",
+ ci->key);
+ return (-1);
+ }
+
temp = ts_strdup (ci->values[0].value.string);
if (temp == NULL)
{
free (data->host);
free (data->plugin);
free (data->plugin_instance);
- free (data->type);
+ /* free (data->type); */
free (data->type_instance);
free (data);
data->host = NULL;
data->plugin = NULL;
data->plugin_instance = NULL;
- data->type = NULL;
+ /* data->type = NULL; */
data->type_instance = NULL;
status = 0;
if ((strcasecmp ("Host", child->key) == 0)
|| (strcasecmp ("Hostname", child->key) == 0))
- status = ts_config_add_string (&data->host, child);
+ status = ts_config_add_string (&data->host, child,
+ /* may be empty = */ 0);
else if (strcasecmp ("Plugin", child->key) == 0)
- status = ts_config_add_string (&data->plugin, child);
+ status = ts_config_add_string (&data->plugin, child,
+ /* may be empty = */ 0);
else if (strcasecmp ("PluginInstance", child->key) == 0)
- status = ts_config_add_string (&data->plugin_instance, child);
+ status = ts_config_add_string (&data->plugin_instance, child,
+ /* may be empty = */ 1);
+#if 0
else if (strcasecmp ("Type", child->key) == 0)
- status = ts_config_add_string (&data->type, child);
+ status = ts_config_add_string (&data->type, child,
+ /* may be empty = */ 0);
+#endif
else if (strcasecmp ("TypeInstance", child->key) == 0)
- status = ts_config_add_string (&data->type_instance, child);
+ status = ts_config_add_string (&data->type_instance, child,
+ /* may be empty = */ 1);
else
{
ERROR ("Target `set': The `%s' configuration option is not understood "
if ((data->host == NULL)
&& (data->plugin == NULL)
&& (data->plugin_instance == NULL)
- && (data->type == NULL)
+ /* && (data->type == NULL) */
&& (data->type_instance == NULL))
{
ERROR ("Target `set': You need to set at lease one of `Host', "
SET_FIELD (host);
SET_FIELD (plugin);
SET_FIELD (plugin_instance);
- SET_FIELD (type);
+ /* SET_FIELD (type); */
SET_FIELD (type_instance);
return (0);