[Nagiosplug-checkins] SF.net SVN: nagiosplug:[2063] nagiosplug/trunk

dermoth at users.sourceforge.net dermoth at users.sourceforge.net
Tue Nov 4 18:41:53 CET 2008


Revision: 2063
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2063&view=rev
Author:   dermoth
Date:     2008-11-04 17:41:53 +0000 (Tue, 04 Nov 2008)

Log Message:
-----------
Make extra-opts (C plugins) behave more like N::P:

  N::P allows both '#' and ';' for comments. Extra-opts used to allow only '#', it now allows both (';' is the standard for ini files)
  Extra-opts does not allow trailing comments anymore (like N::P)

Modified Paths:
--------------
    nagiosplug/trunk/NEWS
    nagiosplug/trunk/lib/parse_ini.c
    nagiosplug/trunk/lib/tests/plugin.ini

Modified: nagiosplug/trunk/NEWS
===================================================================
--- nagiosplug/trunk/NEWS	2008-11-04 04:46:31 UTC (rev 2062)
+++ nagiosplug/trunk/NEWS	2008-11-04 17:41:53 UTC (rev 2063)
@@ -6,6 +6,8 @@
 	check_ifoperstatus -n flag now works as expected (sf.net #1569488)
 	check_ifoperstatus now supports ifType based lookup for ifIndex
 	check_ups now sends a LOGOUT string (debian bug #387001)
+	Extra-opts (C plugins) now allows both '#' and ';' for comments (like N::P)
+	Extra-opts (C plugins) does not allow trailing comments anymore (like N::P)
 
 1.4.13 25th Sept 2008
 	Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen)

Modified: nagiosplug/trunk/lib/parse_ini.c
===================================================================
--- nagiosplug/trunk/lib/parse_ini.c	2008-11-04 04:46:31 UTC (rev 2062)
+++ nagiosplug/trunk/lib/parse_ini.c	2008-11-04 17:41:53 UTC (rev 2063)
@@ -132,6 +132,7 @@
 		if(isspace(c)) continue;
 		switch(c){
 			/* globble up coment lines */
+			case ';':
 			case '#':
 				GOBBLE_TO(f, c, '\n');
 				break;
@@ -232,10 +233,8 @@
 	if(optptr==eqptr) die(STATE_UNKNOWN, _("Config file error\n"));
 	/* continue from '=' to start of value or EOL */
 	for(valptr=eqptr+1; valptr<lineend && isspace(*valptr); valptr++);
-	/* continue to the end of value (FIXME: watching for trailing comments) */
-	for(valend=valptr; valend<lineend; valend++)
-		/* FIXME: N::P doesn't allow comments here. Remove next line and parse_ini won't either */
-		if(*valend=='#') break;
+	/* continue to the end of value */
+	for(valend=valptr; valend<lineend; valend++);
 	--valend;
 	/* Finally trim off trailing spaces */
 	for(valend; isspace(*valend); valend--);

Modified: nagiosplug/trunk/lib/tests/plugin.ini
===================================================================
--- nagiosplug/trunk/lib/tests/plugin.ini	2008-11-04 04:46:31 UTC (rev 2062)
+++ nagiosplug/trunk/lib/tests/plugin.ini	2008-11-04 17:41:53 UTC (rev 2063)
@@ -1,7 +1,10 @@
+# Non-standard (but accepted) comment
+; standard ini comment
 
 [check_mysql]
 username=operator
-password=secret		# Remember to change later
+; comment in the middle
+password=secret  
 
 [section_twice]
 foo=bar


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list