[RFC] shared/tester: Allow to pass extra options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This allows to pass custom GOptionEntry from tester. Will be useful
if tester takes non-standard arguments. void* is used to not leak
Glib API to tester API if extra options are not used.
---
 src/shared/tester.c | 8 ++++++++
 src/shared/tester.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/src/shared/tester.c b/src/shared/tester.c
index 30857e0..6922195 100644
--- a/src/shared/tester.c
+++ b/src/shared/tester.c
@@ -784,12 +784,20 @@ static GOptionEntry options[] = {
 
 void tester_init(int *argc, char ***argv)
 {
+	tester_init_extra(argc, argv, NULL);
+}
+
+void tester_init_extra(int *argc, char ***argv, void *extra)
+{
 	GOptionContext *context;
 	GError *error = NULL;
 
 	context = g_option_context_new(NULL);
 	g_option_context_add_main_entries(context, options, NULL);
 
+	if (extra)
+		g_option_context_add_main_entries(context, extra, NULL);
+
 	if (g_option_context_parse(context, argc, argv, &error) == FALSE) {
 		if (error != NULL) {
 			g_printerr("%s\n", error->message);
diff --git a/src/shared/tester.h b/src/shared/tester.h
index 83ef5de..89a04a2 100644
--- a/src/shared/tester.h
+++ b/src/shared/tester.h
@@ -23,6 +23,7 @@
 
 #include <stdbool.h>
 
+void tester_init_extra(int *argc, char ***argv, void *extra);
 void tester_init(int *argc, char ***argv);
 int tester_run(void);
 
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux