aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Tom Adams <tom@holizz.com>2009-07-08 12:07:52 +0100
committerGravatar Tom Adams <tom@holizz.com>2009-07-11 11:38:44 +0100
commit2e47a381f29a593286374ce8638914383e835993 (patch)
tree852583469e1a925c1a639895ee4980d14d111420
parentc3bbce42762ed8e4409ab2552e2efeee95518425 (diff)
Add -V/--version option to print the commit and exit.
-rw-r--r--uzbl.c7
-rw-r--r--uzbl.h1
2 files changed, 8 insertions, 0 deletions
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]);
diff --git a/uzbl.h b/uzbl.h
index eba060e..9a7ccd2 100644
--- a/uzbl.h
+++ b/uzbl.h
@@ -171,6 +171,7 @@ typedef struct {
gchar* cmd_indicator;
GString* html_buffer;
guint html_timeout;
+ gboolean print_version;
/* command list: name -> Command */
GHashTable* commands;