Add support for printing daemon version
diff --git a/src/main.c b/src/main.c
index c050339..cc83f3d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -302,6 +302,7 @@
static gchar *option_debug = NULL;
static gboolean option_detach = TRUE;
+static gboolean option_version = FALSE;
static gboolean option_udev = FALSE;
static guint last_adapter_timeout = 0;
@@ -352,6 +353,8 @@
{ "debug", 'd', G_OPTION_FLAG_OPTIONAL_ARG,
G_OPTION_ARG_CALLBACK, parse_debug,
"Enable debug information output", "DEBUG" },
+ { "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
+ "Show version information and exit" },
{ "udev", 'u', 0, G_OPTION_ARG_NONE, &option_udev,
"Run from udev mode of operation" },
{ NULL },
@@ -388,6 +391,13 @@
exit(1);
}
+ g_option_context_free(context);
+
+ if (option_version == TRUE) {
+ printf("%s\n", VERSION);
+ exit(0);
+ }
+
if (option_udev == TRUE) {
int err;