projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'github/pr/1749'
[collectd.git]
/
src
/
daemon
/
common.c
diff --git
a/src/daemon/common.c
b/src/daemon/common.c
index
c80abcb
..
3d1420d
100644
(file)
--- a/
src/daemon/common.c
+++ b/
src/daemon/common.c
@@
-1016,7
+1016,8
@@
int format_values (char *ret, size_t ret_len, /* {{{ */
int parse_identifier (char *str, char **ret_host,
char **ret_plugin, char **ret_plugin_instance,
int parse_identifier (char *str, char **ret_host,
char **ret_plugin, char **ret_plugin_instance,
- char **ret_type, char **ret_type_instance)
+ char **ret_type, char **ret_type_instance,
+ char *default_host)
{
char *hostname = NULL;
char *plugin = NULL;
{
char *hostname = NULL;
char *plugin = NULL;
@@
-1035,8
+1036,19
@@
int parse_identifier (char *str, char **ret_host,
type = strchr (plugin, '/');
if (type == NULL)
type = strchr (plugin, '/');
if (type == NULL)
- return (-1);
- *type = '\0'; type++;
+ {
+ if (default_host == NULL)
+ return (-1);
+ /* else: no host specified; use default */
+ type = plugin;
+ plugin = hostname;
+ hostname = default_host;
+ }
+ else
+ {
+ *type = '\0';
+ type++;
+ }
plugin_instance = strchr (plugin, '-');
if (plugin_instance != NULL)
plugin_instance = strchr (plugin, '-');
if (plugin_instance != NULL)
@@
-1077,7
+1089,8
@@
int parse_identifier_vl (const char *str, value_list_t *vl) /* {{{ */
status = parse_identifier (str_copy, &host,
&plugin, &plugin_instance,
status = parse_identifier (str_copy, &host,
&plugin, &plugin_instance,
- &type, &type_instance);
+ &type, &type_instance,
+ /* default_host = */ NULL);
if (status != 0)
return (status);
if (status != 0)
return (status);