SVN: nagios-notify/trunk/nagios-notify

glen glen at pld-linux.org
Fri Oct 24 11:39:31 CEST 2008


Author: glen
Date: Fri Oct 24 11:39:30 2008
New Revision: 9916

Modified:
   nagios-notify/trunk/nagios-notify
Log:
- allow matching multiple $(func:args...) on same line

Modified: nagios-notify/trunk/nagios-notify
==============================================================================
--- nagios-notify/trunk/nagios-notify	(original)
+++ nagios-notify/trunk/nagios-notify	Fri Oct 24 11:39:30 2008
@@ -8,7 +8,7 @@
 # License: Same as Nagios (GPL v2)
 #
 
-templatedir='/etc/nagios/templates'
+templatedir=${NAGIOS_TEMPLATEDIR:-/etc/nagios/templates}
 export NAGIOS_DATADIR='/usr/share/nagios'
 prog="${0##*/}"
 
@@ -249,7 +249,7 @@
 		}
 
 		# $(base64:/path/to/file)
-		if (match($0, /\$\(base64:(.*)\)/)) {
+		while (match($0, /\$\(base64:([^)]+)\)/)) {
 			pos = length("$(base64:")
 			file = substr($0, RSTART + pos, RLENGTH - pos - 1);
 			left = substr($0, 0, RSTART);
@@ -258,7 +258,7 @@
 		}
 
 		# $(encode_mime_header:CHARSET,DATA)
-		if (match($0, /\$\(encode_mime_header:([^,]*,.*)\)/)) {
+		while (match($0, /\$\(encode_mime_header:([^,]*,[^)]+)\)/)) {
 			pos = length("$(encode_mime_header:")
 			params = substr($0, RSTART + pos, RLENGTH - pos - 1);
 			left = substr($0, 0, RSTART);
@@ -268,7 +268,7 @@
 			$0 = left encode_mime_header(charset, data) right;
 		}
 		# $(urlencode:data)
-		if (match($0, /\$\(urlencode:(.*)\)/)) {
+		while (match($0, /\$\(urlencode:([^)]+)\)/)) {
 			pos = length("$(urlencode:")
 			data = substr($0, RSTART + pos, RLENGTH - pos - 1);
 			left = substr($0, 0, RSTART);
@@ -277,7 +277,7 @@
 		}
 
 		# $(math:expression)
-		if (match($0, "\$\(math:("MATH_EXPR") *("MATH_OPS") *("MATH_EXPR")\)")) {
+		while (match($0, "\$\(math:("MATH_EXPR") *("MATH_OPS") *("MATH_EXPR")\)")) {
 			pos = length("$(math:")
 			expr = substr($0, RSTART + pos, RLENGTH - pos - 1);
 			left = substr($0, 0, RSTART);


More information about the pld-cvs-commit mailing list