summaryrefslogtreecommitdiff
path: root/options.c
diff options
context:
space:
mode:
Diffstat (limited to 'options.c')
-rw-r--r--options.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/options.c b/options.c
new file mode 100644
index 0000000..ee237aa
--- /dev/null
+++ b/options.c
@@ -0,0 +1,24 @@
+#include "options.h"
+#include "conf.h"
+
+#include <glib.h>
+
+#include <stdlib.h>
+
+void options_parse(int argc, char **argv, struct options *options) {
+ GError *error = NULL;
+ GOptionContext *context;
+ GOptionEntry entries[] = {
+ {"daemonize", 'd', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_NONE, &options->daemonize, NULL, NULL},
+ {NULL},
+ };
+
+ context = g_option_context_new(NULL);
+ g_option_context_set_summary(context, "audist daemon");
+ g_option_context_add_main_entries(context, entries, NULL);
+ if(g_option_context_parse(context, &argc, &argv, &error) == FALSE) {
+ g_warning(error->message);
+ g_error_free(error);
+ exit(1);
+ }
+}