summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-01-16 19:29:43 -0800
committerMarcel Holtmann <marcel@holtmann.org>2010-01-16 19:29:43 -0800
commite433ddc100bda3a437fb81805ea44348f22e9fcb (patch)
tree2577f112014fa76b29a4177420162612ecf9f876 /src/main.c
parente8d18946b9de07c684ed06494f16900f887c5cd4 (diff)
downloadofono-e433ddc100bda3a437fb81805ea44348f22e9fcb.tar.bz2
Add command line option for printing version number
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 5a8ad6a0..3feea935 100644
--- a/src/main.c
+++ b/src/main.c
@@ -93,15 +93,18 @@ static void system_bus_disconnected(DBusConnection *conn, void *user_data)
g_main_loop_quit(event_loop);
}
-static gboolean option_detach = TRUE;
static gboolean option_debug = FALSE;
+static gboolean option_detach = TRUE;
+static gboolean option_version = FALSE;
static GOptionEntry options[] = {
+ { "debug", 'd', 0, G_OPTION_ARG_NONE, &option_debug,
+ "Enable debug information output" },
{ "nodetach", 'n', G_OPTION_FLAG_REVERSE,
G_OPTION_ARG_NONE, &option_detach,
"Don't run as daemon in background" },
- { "debug", 'd', 0, G_OPTION_ARG_NONE, &option_debug,
- "Enable debug information output" },
+ { "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
+ "Show version information and exit" },
{ NULL },
};
@@ -161,6 +164,11 @@ int main(int argc, char **argv)
g_option_context_free(context);
+ if (option_version == TRUE) {
+ printf("%s\n", VERSION);
+ exit(0);
+ }
+
if (option_detach == TRUE) {
if (daemon(0, 0)) {
perror("Can't start daemon");