[collectd] [PATCH] contrib/cussh.pl: Fixed input line parsing.

Sebastian Harl sh at tokkee.org
Tue Mar 25 19:31:37 CET 2008


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 <sh at tokkee.org>
---
 contrib/cussh.pl |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/contrib/cussh.pl b/contrib/cussh.pl
index df3df34..6da2856 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));
-- 
1.5.5.rc1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080325/7ce653d2/attachment.pgp 


More information about the collectd mailing list