From: Sebastian Harl Date: Tue, 25 Mar 2008 18:31:37 +0000 (+0100) Subject: contrib/cussh.pl: Fixed input line parsing. X-Git-Tag: collectd-4.4.0~69 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=0b40e1fbdc404d980cb6b4256d9ff6ba6ab94bb8;p=collectd.git contrib/cussh.pl: Fixed input line parsing. The regexes parsing the user input lines have been adopted to take into account that the newline at the end of the line has been removed. Signed-off-by: Sebastian Harl Signed-off-by: Florian Forster --- diff --git a/contrib/cussh.pl b/contrib/cussh.pl index df3df344..6da2856d 100755 --- a/contrib/cussh.pl +++ b/contrib/cussh.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl # # collectd - contrib/cussh.pl -# Copyright (C) 2007 Sebastian Harl +# Copyright (C) 2007-2008 Sebastian Harl # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the @@ -83,7 +83,7 @@ use Collectd::Unixsock(); last if ($line =~ m/^quit$/i); - my ($cmd) = $line =~ m/^(\w+)\s+/; + my ($cmd) = $line =~ m/^(\w+)\s*/; $line = $'; next if (! $cmd); @@ -113,7 +113,7 @@ sub getid { print $$string . $/; my ($h, $p, $pi, $t, $ti) = - $$string =~ m/^(\w+)\/(\w+)(?:-(\w+))?\/(\w+)(?:-(\w+))?\s+/; + $$string =~ m/^(\w+)\/(\w+)(?:-(\w+))?\/(\w+)(?:-(\w+))?\s*/; $$string = $'; return if ((! $h) || (! $p) || (! $t));