diff options
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-03-31 05:31:14 +0000 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-03-31 05:31:14 +0000 |
commit | 20a8bf1a3ffcdf0e715e03ad654a4a08673e870f (patch) | |
tree | 742d894aa5c7a7ee844b855d0a4d6e27ff302cb6 | |
parent | 8aa5ec317af49d811b1c4b65c905cca81f845321 (diff) | |
download | monitoring-plugins-20a8bf1a3ffcdf0e715e03ad654a4a08673e870f.tar.gz |
Fix for last commit - I accidentaly broke my local Makefile and tests weren't being re-compiled.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1968 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r-- | lib/extra_opts.c | 14 | ||||
-rw-r--r-- | lib/extra_opts.h | 1 | ||||
-rw-r--r-- | lib/parse_ini.c | 2 | ||||
-rw-r--r-- | lib/parse_ini.h | 1 | ||||
-rw-r--r-- | lib/tests/test_ini.c | 2 | ||||
-rw-r--r-- | lib/tests/test_opts.c | 18 |
6 files changed, 21 insertions, 17 deletions
diff --git a/lib/extra_opts.c b/lib/extra_opts.c index 2aeb77ac..e4251215 100644 --- a/lib/extra_opts.c +++ b/lib/extra_opts.c | |||
@@ -26,10 +26,9 @@ | |||
26 | *****************************************************************************/ | 26 | *****************************************************************************/ |
27 | 27 | ||
28 | #include "common.h" | 28 | #include "common.h" |
29 | #include "extra_opts.h" | ||
30 | #include "parse_ini.h" | ||
31 | #include "utils_base.h" | 29 | #include "utils_base.h" |
32 | #include <ctype.h> | 30 | #include "parse_ini.h" |
31 | #include "extra_opts.h" | ||
33 | 32 | ||
34 | /* FIXME: copied from utils.h; we should move a bunch of libs! */ | 33 | /* FIXME: copied from utils.h; we should move a bunch of libs! */ |
35 | int | 34 | int |
@@ -66,7 +65,7 @@ char **np_extra_opts(int *argc, char **argv, const char *plugin_name){ | |||
66 | /* Delete the extra opts argument */ | 65 | /* Delete the extra opts argument */ |
67 | for(j=i;j<*argc;j++) argv[j]=argv[j+1]; | 66 | for(j=i;j<*argc;j++) argv[j]=argv[j+1]; |
68 | i--; | 67 | i--; |
69 | *argc--; | 68 | *argc-=1; |
70 | }else if(strcmp(argv[i], "--extra-opts")==0){ | 69 | }else if(strcmp(argv[i], "--extra-opts")==0){ |
71 | if(!is_option(argv[i+1])){ | 70 | if(!is_option(argv[i+1])){ |
72 | /* It is a argument with separate value */ | 71 | /* It is a argument with separate value */ |
@@ -82,7 +81,7 @@ char **np_extra_opts(int *argc, char **argv, const char *plugin_name){ | |||
82 | /* Delete the extra opts argument */ | 81 | /* Delete the extra opts argument */ |
83 | for(j=i;j<*argc;j++) argv[j]=argv[j+1]; | 82 | for(j=i;j<*argc;j++) argv[j]=argv[j+1]; |
84 | i--; | 83 | i--; |
85 | *argc--; | 84 | *argc-=1; |
86 | } | 85 | } |
87 | } | 86 | } |
88 | 87 | ||
@@ -102,7 +101,10 @@ char **np_extra_opts(int *argc, char **argv, const char *plugin_name){ | |||
102 | while(ea1=ea1->next) ea_num++; | 101 | while(ea1=ea1->next) ea_num++; |
103 | }else{ | 102 | }else{ |
104 | ea_tmp=extra_args; | 103 | ea_tmp=extra_args; |
105 | while(ea_tmp=ea_tmp->next) ea_num++; | 104 | while(ea_tmp->next) { |
105 | ea_tmp=ea_tmp->next; | ||
106 | ea_num++; | ||
107 | } | ||
106 | ea_tmp->next=ea1; | 108 | ea_tmp->next=ea1; |
107 | } | 109 | } |
108 | ea1=ea_tmp=NULL; | 110 | ea1=ea_tmp=NULL; |
diff --git a/lib/extra_opts.h b/lib/extra_opts.h index 25bfc6db..8ce09036 100644 --- a/lib/extra_opts.h +++ b/lib/extra_opts.h | |||
@@ -17,3 +17,4 @@ | |||
17 | char **np_extra_opts(int *argc, char **argv, const char *plugin_name); | 17 | char **np_extra_opts(int *argc, char **argv, const char *plugin_name); |
18 | 18 | ||
19 | #endif /* _EXTRA_OPTS_H_ */ | 19 | #endif /* _EXTRA_OPTS_H_ */ |
20 | |||
diff --git a/lib/parse_ini.c b/lib/parse_ini.c index 67d8367f..e2e5d2c5 100644 --- a/lib/parse_ini.c +++ b/lib/parse_ini.c | |||
@@ -26,8 +26,8 @@ | |||
26 | *****************************************************************************/ | 26 | *****************************************************************************/ |
27 | 27 | ||
28 | #include "common.h" | 28 | #include "common.h" |
29 | #include "parse_ini.h" | ||
30 | #include "utils_base.h" | 29 | #include "utils_base.h" |
30 | #include "parse_ini.h" | ||
31 | #include <ctype.h> | 31 | #include <ctype.h> |
32 | 32 | ||
33 | #include <sys/types.h> | 33 | #include <sys/types.h> |
diff --git a/lib/parse_ini.h b/lib/parse_ini.h index 309dce52..6357a0ee 100644 --- a/lib/parse_ini.h +++ b/lib/parse_ini.h | |||
@@ -59,3 +59,4 @@ typedef struct np_arg_el { | |||
59 | np_arg_list* np_get_defaults(const char *locator, const char *default_section); | 59 | np_arg_list* np_get_defaults(const char *locator, const char *default_section); |
60 | 60 | ||
61 | #endif /* _PARSE_INI_H_ */ | 61 | #endif /* _PARSE_INI_H_ */ |
62 | |||
diff --git a/lib/tests/test_ini.c b/lib/tests/test_ini.c index 84749279..80396caa 100644 --- a/lib/tests/test_ini.c +++ b/lib/tests/test_ini.c | |||
@@ -18,8 +18,8 @@ | |||
18 | *****************************************************************************/ | 18 | *****************************************************************************/ |
19 | 19 | ||
20 | #include "common.h" | 20 | #include "common.h" |
21 | #include "parse_ini.h" | ||
22 | #include "utils_base.h" | 21 | #include "utils_base.h" |
22 | #include "parse_ini.h" | ||
23 | 23 | ||
24 | #include "tap.h" | 24 | #include "tap.h" |
25 | 25 | ||
diff --git a/lib/tests/test_opts.c b/lib/tests/test_opts.c index 7c173f30..54210fba 100644 --- a/lib/tests/test_opts.c +++ b/lib/tests/test_opts.c | |||
@@ -18,8 +18,8 @@ | |||
18 | *****************************************************************************/ | 18 | *****************************************************************************/ |
19 | 19 | ||
20 | #include "common.h" | 20 | #include "common.h" |
21 | #include "extra_opts.h" | ||
22 | #include "utils_base.h" | 21 | #include "utils_base.h" |
22 | #include "extra_opts.h" | ||
23 | 23 | ||
24 | #include "tap.h" | 24 | #include "tap.h" |
25 | 25 | ||
@@ -119,7 +119,7 @@ main (int argc, char **argv) | |||
119 | argv_known[2] = "--something else=oops"; | 119 | argv_known[2] = "--something else=oops"; |
120 | argv_known[3] = "--this=that"; | 120 | argv_known[3] = "--this=that"; |
121 | argv_known[4] = NULL; | 121 | argv_known[4] = NULL; |
122 | argv_test=np_extra_opts(argc_test, argv_test, "check_disk"); | 122 | argv_test=np_extra_opts(&argc_test, argv_test, "check_disk"); |
123 | ok(array_diff(argc_test, argv_test, 4, argv_known), "Only extra opts specified twice"); | 123 | ok(array_diff(argc_test, argv_test, 4, argv_known), "Only extra opts specified twice"); |
124 | my_free(&argc_test,argv_test); | 124 | my_free(&argc_test,argv_test); |
125 | 125 | ||
@@ -141,7 +141,7 @@ main (int argc, char **argv) | |||
141 | argv_known[5] = "--arg1=val1"; | 141 | argv_known[5] = "--arg1=val1"; |
142 | argv_known[6] = "--arg2"; | 142 | argv_known[6] = "--arg2"; |
143 | argv_known[7] = NULL; | 143 | argv_known[7] = NULL; |
144 | argv_test=np_extra_opts(argc_test, argv_test, "check_disk"); | 144 | argv_test=np_extra_opts(&argc_test, argv_test, "check_disk"); |
145 | ok(array_diff(argc_test, argv_test, 7, argv_known), "twice extra opts using two sections"); | 145 | ok(array_diff(argc_test, argv_test, 7, argv_known), "twice extra opts using two sections"); |
146 | my_free(&argc_test,argv_test); | 146 | my_free(&argc_test,argv_test); |
147 | 147 | ||
@@ -162,7 +162,7 @@ main (int argc, char **argv) | |||
162 | argv_known[2] = "--arg3"; | 162 | argv_known[2] = "--arg3"; |
163 | argv_known[3] = "val2"; | 163 | argv_known[3] = "val2"; |
164 | argv_known[4] = NULL; | 164 | argv_known[4] = NULL; |
165 | argv_test=np_extra_opts(argc_test, argv_test, "check_missing"); | 165 | argv_test=np_extra_opts(&argc_test, argv_test, "check_missing"); |
166 | ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 1"); | 166 | ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 1"); |
167 | my_free(&argc_test,argv_test); | 167 | my_free(&argc_test,argv_test); |
168 | 168 | ||
@@ -181,7 +181,7 @@ main (int argc, char **argv) | |||
181 | argv_known[2] = "--arg3"; | 181 | argv_known[2] = "--arg3"; |
182 | argv_known[3] = "val2"; | 182 | argv_known[3] = "val2"; |
183 | argv_known[4] = NULL; | 183 | argv_known[4] = NULL; |
184 | argv_test=np_extra_opts(argc_test, argv_test, "check_missing"); | 184 | argv_test=np_extra_opts(&argc_test, argv_test, "check_missing"); |
185 | ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 2"); | 185 | ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 2"); |
186 | my_free(&argc_test,argv_test); | 186 | my_free(&argc_test,argv_test); |
187 | 187 | ||
@@ -199,7 +199,7 @@ main (int argc, char **argv) | |||
199 | argv_known[2] = "--arg3"; | 199 | argv_known[2] = "--arg3"; |
200 | argv_known[3] = "val2"; | 200 | argv_known[3] = "val2"; |
201 | argv_known[4] = NULL; | 201 | argv_known[4] = NULL; |
202 | argv_test=np_extra_opts(argc_test, argv_test, "check_missing"); | 202 | argv_test=np_extra_opts(&argc_test, argv_test, "check_missing"); |
203 | ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 3"); | 203 | ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 3"); |
204 | my_free(&argc_test,argv_test); | 204 | my_free(&argc_test,argv_test); |
205 | 205 | ||
@@ -219,7 +219,7 @@ main (int argc, char **argv) | |||
219 | argv_known[3] = "--arg3"; | 219 | argv_known[3] = "--arg3"; |
220 | argv_known[4] = "val2"; | 220 | argv_known[4] = "val2"; |
221 | argv_known[5] = NULL; | 221 | argv_known[5] = NULL; |
222 | argv_test=np_extra_opts(argc_test, argv_test, "check_disk"); | 222 | argv_test=np_extra_opts(&argc_test, argv_test, "check_disk"); |
223 | ok(array_diff(argc_test, argv_test, 5, argv_known), "Default section 1"); | 223 | ok(array_diff(argc_test, argv_test, 5, argv_known), "Default section 1"); |
224 | my_free(&argc_test,argv_test); | 224 | my_free(&argc_test,argv_test); |
225 | 225 | ||
@@ -238,7 +238,7 @@ main (int argc, char **argv) | |||
238 | argv_known[3] = "--arg3"; | 238 | argv_known[3] = "--arg3"; |
239 | argv_known[4] = "val2"; | 239 | argv_known[4] = "val2"; |
240 | argv_known[5] = NULL; | 240 | argv_known[5] = NULL; |
241 | argv_test=np_extra_opts(argc_test, argv_test, "check_disk"); | 241 | argv_test=np_extra_opts(&argc_test, argv_test, "check_disk"); |
242 | ok(array_diff(argc_test, argv_test, 5, argv_known), "Default section 2"); | 242 | ok(array_diff(argc_test, argv_test, 5, argv_known), "Default section 2"); |
243 | my_free(&argc_test,argv_test); | 243 | my_free(&argc_test,argv_test); |
244 | 244 | ||
@@ -257,7 +257,7 @@ main (int argc, char **argv) | |||
257 | argv_known[3] = "--arg3"; | 257 | argv_known[3] = "--arg3"; |
258 | argv_known[4] = "val2"; | 258 | argv_known[4] = "val2"; |
259 | argv_known[5] = NULL; | 259 | argv_known[5] = NULL; |
260 | argv_test=np_extra_opts(argc_test, argv_test, "check_disk"); | 260 | argv_test=np_extra_opts(&argc_test, argv_test, "check_disk"); |
261 | ok(array_diff(argc_test, argv_test, 5, argv_known), "Default section 3"); | 261 | ok(array_diff(argc_test, argv_test, 5, argv_known), "Default section 3"); |
262 | my_free(&argc_test,argv_test); | 262 | my_free(&argc_test,argv_test); |
263 | 263 | ||