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;
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)
status = parse_identifier (str_copy, &host,
&plugin, &plugin_instance,
- &type, &type_instance);
+ &type, &type_instance,
+ /* default_host = */ NULL);
if (status != 0)
return (status);