From 2e47a381f29a593286374ce8638914383e835993 Mon Sep 17 00:00:00 2001 From: Tom Adams Date: Wed, 8 Jul 2009 12:07:52 +0100 Subject: Add -V/--version option to print the commit and exit. --- uzbl.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index c82e7be..a998b91 100644 --- a/uzbl.c +++ b/uzbl.c @@ -75,6 +75,8 @@ GOptionEntry entries[] = "Config file (this is pretty much equivalent to uzbl < FILE )", "FILE" }, { "socket", 's', 0, G_OPTION_ARG_INT, &uzbl.state.socket_id, "Socket ID", "SOCKET" }, + { "version", 'V', 0, G_OPTION_ARG_NONE, &uzbl.behave.print_version, + "Print the version and exit", NULL }, { NULL, 0, 0, 0, NULL, NULL, NULL } }; @@ -2700,6 +2702,11 @@ main (int argc, char* argv[]) { g_option_context_parse (context, &argc, &argv, NULL); g_option_context_free(context); + if (uzbl.behave.print_version) { + printf("Commit: %s\n", COMMIT); + exit(0); + } + gchar *uri_override = (uzbl.state.uri ? g_strdup(uzbl.state.uri) : NULL); if (argc > 1 && !uzbl.state.uri) uri_override = g_strdup(argv[1]); -- cgit v1.2.3