diff options
Diffstat (limited to 'src/sdtui.c')
-rw-r--r-- | src/sdtui.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/sdtui.c b/src/sdtui.c index fa3a291..ff795ea 100644 --- a/src/sdtui.c +++ b/src/sdtui.c @@ -37,6 +37,7 @@ #include <errno.h> #include <signal.h> +#include "config.h" #include "stardict.h" @@ -849,8 +850,12 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS g_type_init (); G_GNUC_END_IGNORE_DEPRECATIONS - static GOptionEntry entries[] = + gboolean show_version = FALSE; + GOptionEntry entries[] = { + { "version", 0, G_OPTION_FLAG_IN_MAIN, + G_OPTION_ARG_NONE, &show_version, + "Output version information and exit", NULL }, { NULL } }; @@ -868,6 +873,12 @@ G_GNUC_END_IGNORE_DEPRECATIONS exit (EXIT_FAILURE); } + if (show_version) + { + g_print (PROJECT_NAME " " PROJECT_VERSION "\n"); + exit (EXIT_SUCCESS); + } + if (argc != 2) { gchar *help = g_option_context_get_help (ctx, TRUE, FALSE); |