X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=contrib%2Fcussh.pl;h=23a9078f121799d8f7d68a1e40fe6e5ef901c3e7;hb=4e6812d3e5073e5b4bd7eaef9f2539c8c9dd28a4;hp=48f5e9373e12dba530c0ff1a6a2292effd5ded39;hpb=d9f299b9b2f9b84d423127c499237e6674209fab;p=collectd.git diff --git a/contrib/cussh.pl b/contrib/cussh.pl index 48f5e937..23a9078f 100755 --- a/contrib/cussh.pl +++ b/contrib/cussh.pl @@ -113,7 +113,7 @@ sub getid { print $$string . $/; my ($h, $p, $pi, $t, $ti) = - $$string =~ m/^(\w+)\/(\w+)(?:-(\w+))?\/(\w+)(?:-(\w+))?\s*/; + $$string =~ m#^([^/]+)/([^/-]+)(?:-([^/]+))?/([^/-]+)(?:-([^/]+))?\s*#; $$string = $'; return if ((! $h) || (! $p) || (! $t)); @@ -122,8 +122,8 @@ sub getid { ($id{'host'}, $id{'plugin'}, $id{'type'}) = ($h, $p, $t); - $id{'plugin_instance'} = $pi if ($pi); - $id{'type_instance'} = $ti if ($ti); + $id{'plugin_instance'} = $pi if defined ($pi); + $id{'type_instance'} = $ti if defined ($ti); return \%id; }