summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-07-12 19:45:13 -0300
committerMarcel Holtmann <marcel@holtmann.org>2010-07-12 19:45:13 -0300
commit7b25c5a15c95be8d3dc302d764c175e6772fdbd4 (patch)
treea8b7be6511e2259ea06ca7effafb2d15a3b1c3ac
parent11698717de7f675bc79f5256b807feaa350ad9f7 (diff)
downloadbluez-7b25c5a15c95be8d3dc302d764c175e6772fdbd4.tar.gz
Add support for printing daemon version
-rw-r--r--src/main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index c05033938..cc83f3d49 100644
--- a/src/main.c
+++ b/src/main.c
@@ -302,6 +302,7 @@ static void sig_debug(int sig)
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 @@ static GOptionEntry options[] = {
{ "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 @@ int main(int argc, char *argv[])
exit(1);
}
+ g_option_context_free(context);
+
+ if (option_version == TRUE) {
+ printf("%s\n", VERSION);
+ exit(0);
+ }
+
if (option_udev == TRUE) {
int err;