summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2008-11-04 17:41:53 +0000
committerThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2008-11-04 17:41:53 +0000
commit51ec51a8dcbe003a0fe5cd0ad1d78f5590f5d40f (patch)
tree8d7b3ba9abc238ff7f303f17d874d8935e52c846
parent47fddad5fd5808cd5540a9c8c1a72d8a66348546 (diff)
downloadmonitoring-plugins-51ec51a8dcbe003a0fe5cd0ad1d78f5590f5d40f.tar.gz
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) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2063 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--NEWS2
-rw-r--r--lib/parse_ini.c7
-rw-r--r--lib/tests/plugin.ini5
3 files changed, 9 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index 01567017..42eb761e 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ This file documents the major additions and syntax changes between releases.
6 check_ifoperstatus -n flag now works as expected (sf.net #1569488) 6 check_ifoperstatus -n flag now works as expected (sf.net #1569488)
7 check_ifoperstatus now supports ifType based lookup for ifIndex 7 check_ifoperstatus now supports ifType based lookup for ifIndex
8 check_ups now sends a LOGOUT string (debian bug #387001) 8 check_ups now sends a LOGOUT string (debian bug #387001)
9 Extra-opts (C plugins) now allows both '#' and ';' for comments (like N::P)
10 Extra-opts (C plugins) does not allow trailing comments anymore (like N::P)
9 11
101.4.13 25th Sept 2008 121.4.13 25th Sept 2008
11 Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen) 13 Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen)
diff --git a/lib/parse_ini.c b/lib/parse_ini.c
index 654452d8..57321753 100644
--- a/lib/parse_ini.c
+++ b/lib/parse_ini.c
@@ -132,6 +132,7 @@ static int read_defaults(FILE *f, const char *stanza, np_arg_list **opts){
132 if(isspace(c)) continue; 132 if(isspace(c)) continue;
133 switch(c){ 133 switch(c){
134 /* globble up coment lines */ 134 /* globble up coment lines */
135 case ';':
135 case '#': 136 case '#':
136 GOBBLE_TO(f, c, '\n'); 137 GOBBLE_TO(f, c, '\n');
137 break; 138 break;
@@ -232,10 +233,8 @@ static int add_option(FILE *f, np_arg_list **optlst){
232 if(optptr==eqptr) die(STATE_UNKNOWN, _("Config file error\n")); 233 if(optptr==eqptr) die(STATE_UNKNOWN, _("Config file error\n"));
233 /* continue from '=' to start of value or EOL */ 234 /* continue from '=' to start of value or EOL */
234 for(valptr=eqptr+1; valptr<lineend && isspace(*valptr); valptr++); 235 for(valptr=eqptr+1; valptr<lineend && isspace(*valptr); valptr++);
235 /* continue to the end of value (FIXME: watching for trailing comments) */ 236 /* continue to the end of value */
236 for(valend=valptr; valend<lineend; valend++) 237 for(valend=valptr; valend<lineend; valend++);
237 /* FIXME: N::P doesn't allow comments here. Remove next line and parse_ini won't either */
238 if(*valend=='#') break;
239 --valend; 238 --valend;
240 /* Finally trim off trailing spaces */ 239 /* Finally trim off trailing spaces */
241 for(valend; isspace(*valend); valend--); 240 for(valend; isspace(*valend); valend--);
diff --git a/lib/tests/plugin.ini b/lib/tests/plugin.ini
index e22f8bdb..511fd9f6 100644
--- a/lib/tests/plugin.ini
+++ b/lib/tests/plugin.ini
@@ -1,7 +1,10 @@
1# Non-standard (but accepted) comment
2; standard ini comment
1 3
2[check_mysql] 4[check_mysql]
3username=operator 5username=operator
4password=secret # Remember to change later 6; comment in the middle
7password=secret
5 8
6[section_twice] 9[section_twice]
7foo=bar 10foo=bar