summaryrefslogtreecommitdiffstats
path: root/lib/extra_opts.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:48:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:48:22 +0000
commit7373ce3d6988706388f136e1c06afd20a3e8d5be (patch)
treee9ae5af7d102667e5706187646db45de8238e8c4 /lib/extra_opts.h
parentInitial commit. (diff)
downloadmonitoring-plugins-upstream.tar.xz
monitoring-plugins-upstream.zip
Adding upstream version 2.3.5.upstream/2.3.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/extra_opts.h')
-rw-r--r--lib/extra_opts.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/extra_opts.h b/lib/extra_opts.h
new file mode 100644
index 0000000..8ff14a1
--- /dev/null
+++ b/lib/extra_opts.h
@@ -0,0 +1,23 @@
+#ifndef _EXTRA_OPTS_H_
+#define _EXTRA_OPTS_H_
+
+/*
+ * extra_opts.h: routines for loading monitoring-plugin defaults from ini
+ * configuration files.
+ */
+
+/* np_extra_opts: Process the --extra-opts arguments and create a new argument
+ * array with ini-processed and argument-passed arguments together. The
+ * ini-procesed arguments always come first (in the order of --extra-opts
+ * arguments). If no --extra-opts arguments are provided or returned nothing
+ * it returns **argv otherwise the new array is returned. --extra-opts are
+ * always removed from **argv. The original pointers from **argv are kept in
+ * the new array to preserve ability to overwrite arguments in processlist.
+ *
+ * The new array can be easily freed as long as a pointer to the original one
+ * is kept. See my_free() in lib/tests/test_opts1.c for an example.
+ */
+char **np_extra_opts(int *argc, char **argv, const char *plugin_name);
+
+#endif /* _EXTRA_OPTS_H_ */
+