From 9dbe847630b6fb2c8b82d36e26d1436fae64aa35 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 13 May 2008 16:51:26 +0200 Subject: [PATCH] contrib/cussh.pl: Improve parsing of identifiers. --- contrib/cussh.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; } -- 2.30.2