From: Florian Forster Date: Tue, 13 May 2008 14:51:26 +0000 (+0200) Subject: contrib/cussh.pl: Improve parsing of identifiers. X-Git-Tag: collectd-4.4.1~7^2~1 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=9dbe847630b6fb2c8b82d36e26d1436fae64aa35;hp=759c544568c019721fe868e7c319bd1471fd501c;p=collectd.git contrib/cussh.pl: Improve parsing of identifiers. --- diff --git a/contrib/cussh.pl b/contrib/cussh.pl index 65c634e0..d4126bfd 100755 --- a/contrib/cussh.pl +++ b/contrib/cussh.pl @@ -105,7 +105,11 @@ sub getid { print $$string . $/; my ($h, $p, $pi, $t, $ti) = +<<<<<<< collectd-4.3:contrib/cussh.pl $$string =~ m/^(\w+)\/(\w+)(?:-(\w+))?\/(\w+)(?:-(\w+))?\s+/; +======= + $$string =~ m#^([^/]+)/([^/-]+)(?:-([^/]+))?/([^/-]+)(?:-([^/]+))?\s*#; +>>>>>>> local:contrib/cussh.pl $$string = $'; return if ((! $h) || (! $p) || (! $t)); @@ -114,8 +118,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; }