summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8aa5ec3)
raw | patch | inline | side by side (parent: 8aa5ec3)
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | |
Mon, 31 Mar 2008 05:31:14 +0000 (05:31 +0000) | ||
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | |
Mon, 31 Mar 2008 05:31:14 +0000 (05:31 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1968 f882894a-f735-0410-b71e-b25c423dba1c
diff --git a/lib/extra_opts.c b/lib/extra_opts.c
index 2aeb77ac2ab0b618025358bdb2e072cdffb95ea5..e4251215abf467102972e36723fa133386932a47 100644 (file)
--- a/lib/extra_opts.c
+++ b/lib/extra_opts.c
*****************************************************************************/
#include "common.h"
-#include "extra_opts.h"
-#include "parse_ini.h"
#include "utils_base.h"
-#include <ctype.h>
+#include "parse_ini.h"
+#include "extra_opts.h"
/* FIXME: copied from utils.h; we should move a bunch of libs! */
int
/* Delete the extra opts argument */
for(j=i;j<*argc;j++) argv[j]=argv[j+1];
i--;
- *argc--;
+ *argc-=1;
}else if(strcmp(argv[i], "--extra-opts")==0){
if(!is_option(argv[i+1])){
/* It is a argument with separate value */
/* Delete the extra opts argument */
for(j=i;j<*argc;j++) argv[j]=argv[j+1];
i--;
- *argc--;
+ *argc-=1;
}
}
while(ea1=ea1->next) ea_num++;
}else{
ea_tmp=extra_args;
- while(ea_tmp=ea_tmp->next) ea_num++;
+ while(ea_tmp->next) {
+ ea_tmp=ea_tmp->next;
+ ea_num++;
+ }
ea_tmp->next=ea1;
}
ea1=ea_tmp=NULL;
diff --git a/lib/extra_opts.h b/lib/extra_opts.h
index 25bfc6db1601699d99332778baf66cb6384cd947..8ce09036fa509f33eb8153ddc73b67c7e9731a6b 100644 (file)
--- a/lib/extra_opts.h
+++ b/lib/extra_opts.h
char **np_extra_opts(int *argc, char **argv, const char *plugin_name);
#endif /* _EXTRA_OPTS_H_ */
+
diff --git a/lib/parse_ini.c b/lib/parse_ini.c
index 67d8367f5503c21a7fd5cd3217bcdd60f055ac6b..e2e5d2c5e237b36e99eeba73ea7a5e519a08e041 100644 (file)
--- a/lib/parse_ini.c
+++ b/lib/parse_ini.c
*****************************************************************************/
#include "common.h"
-#include "parse_ini.h"
#include "utils_base.h"
+#include "parse_ini.h"
#include <ctype.h>
#include <sys/types.h>
diff --git a/lib/parse_ini.h b/lib/parse_ini.h
index 309dce5213fecf3214fb6d9e6cfa5a670c3b17c9..6357a0eec89524dab951fc5533f3367361d3066e 100644 (file)
--- a/lib/parse_ini.h
+++ b/lib/parse_ini.h
np_arg_list* np_get_defaults(const char *locator, const char *default_section);
#endif /* _PARSE_INI_H_ */
+
diff --git a/lib/tests/test_ini.c b/lib/tests/test_ini.c
index 84749279b1a713442c7aed48ac8e3963dacaf5b0..80396caa5a222359e46fa8f8da702ab836403e40 100644 (file)
--- a/lib/tests/test_ini.c
+++ b/lib/tests/test_ini.c
*****************************************************************************/
#include "common.h"
-#include "parse_ini.h"
#include "utils_base.h"
+#include "parse_ini.h"
#include "tap.h"
diff --git a/lib/tests/test_opts.c b/lib/tests/test_opts.c
index 7c173f30dbe89a886f00ced600e69b794850e8b8..54210fba8e8e8498b36f95b09c5431329e642e03 100644 (file)
--- a/lib/tests/test_opts.c
+++ b/lib/tests/test_opts.c
*****************************************************************************/
#include "common.h"
-#include "extra_opts.h"
#include "utils_base.h"
+#include "extra_opts.h"
#include "tap.h"
argv_known[2] = "--something else=oops";
argv_known[3] = "--this=that";
argv_known[4] = NULL;
- argv_test=np_extra_opts(argc_test, argv_test, "check_disk");
+ argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
ok(array_diff(argc_test, argv_test, 4, argv_known), "Only extra opts specified twice");
my_free(&argc_test,argv_test);
argv_known[5] = "--arg1=val1";
argv_known[6] = "--arg2";
argv_known[7] = NULL;
- argv_test=np_extra_opts(argc_test, argv_test, "check_disk");
+ argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
ok(array_diff(argc_test, argv_test, 7, argv_known), "twice extra opts using two sections");
my_free(&argc_test,argv_test);
argv_known[2] = "--arg3";
argv_known[3] = "val2";
argv_known[4] = NULL;
- argv_test=np_extra_opts(argc_test, argv_test, "check_missing");
+ argv_test=np_extra_opts(&argc_test, argv_test, "check_missing");
ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 1");
my_free(&argc_test,argv_test);
argv_known[2] = "--arg3";
argv_known[3] = "val2";
argv_known[4] = NULL;
- argv_test=np_extra_opts(argc_test, argv_test, "check_missing");
+ argv_test=np_extra_opts(&argc_test, argv_test, "check_missing");
ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 2");
my_free(&argc_test,argv_test);
argv_known[2] = "--arg3";
argv_known[3] = "val2";
argv_known[4] = NULL;
- argv_test=np_extra_opts(argc_test, argv_test, "check_missing");
+ argv_test=np_extra_opts(&argc_test, argv_test, "check_missing");
ok(array_diff(argc_test, argv_test, 4, argv_known), "Missing section 3");
my_free(&argc_test,argv_test);
argv_known[3] = "--arg3";
argv_known[4] = "val2";
argv_known[5] = NULL;
- argv_test=np_extra_opts(argc_test, argv_test, "check_disk");
+ argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
ok(array_diff(argc_test, argv_test, 5, argv_known), "Default section 1");
my_free(&argc_test,argv_test);
argv_known[3] = "--arg3";
argv_known[4] = "val2";
argv_known[5] = NULL;
- argv_test=np_extra_opts(argc_test, argv_test, "check_disk");
+ argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
ok(array_diff(argc_test, argv_test, 5, argv_known), "Default section 2");
my_free(&argc_test,argv_test);
argv_known[3] = "--arg3";
argv_known[4] = "val2";
argv_known[5] = NULL;
- argv_test=np_extra_opts(argc_test, argv_test, "check_disk");
+ argv_test=np_extra_opts(&argc_test, argv_test, "check_disk");
ok(array_diff(argc_test, argv_test, 5, argv_known), "Default section 3");
my_free(&argc_test,argv_test);