From 671966ae7bb69fc04952a8accaa52fae5e77d8bb Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sat, 4 Sep 2010 01:20:33 +0200 Subject: Added command-line options and daemonizer. --- options.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 options.c (limited to 'options.c') 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 + +#include + +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); + } +} -- cgit v1.2.3