summaryrefslogtreecommitdiff
path: root/pango/querymodules.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-02-15 05:39:20 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-02-15 05:39:20 +0000
commitd621408f949a6515ad50b94f97a9ba234ed9d53d (patch)
treef6dad4211c6b864ca63f1d64ea0194526e1474b3 /pango/querymodules.c
parent29e34c2beb3770f9e83b5c1b15cbae40a7100772 (diff)
downloadpango-d621408f949a6515ad50b94f97a9ba234ed9d53d.tar.gz
Bug 331038 – pango-querymodules --help and --version Patch from Antoine
2006-02-15 Behdad Esfahbod <behdad@gnome.org> Bug 331038 – pango-querymodules --help and --version Patch from Antoine Dopffer. * examples/renderdemo.c, pango/querymodules.c: Add --version option.
Diffstat (limited to 'pango/querymodules.c')
-rw-r--r--pango/querymodules.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/pango/querymodules.c b/pango/querymodules.c
index 65a91b89..72dd2183 100644
--- a/pango/querymodules.c
+++ b/pango/querymodules.c
@@ -19,6 +19,7 @@
* Boston, MA 02111-1307, USA.
*/
+#include <stdlib.h>
#include <config.h>
#include <glib.h>
@@ -181,13 +182,50 @@ query_module (const char *dir, const char *name)
g_module_close (module);
}
+static gboolean
+show_version(const char *name,
+ const char *arg,
+ gpointer data,
+ GError **error)
+{
+ g_printf("pango-querymodules (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION);
+ g_printf("module interface version: %s\n", MODULE_VERSION);
+ exit(0);
+}
+
int
main (int argc, char **argv)
{
char *cwd;
int i;
char *path;
-
+ GOptionContext *context;
+ GError *parse_error = NULL;
+ GOptionEntry entries[] =
+ {
+ {"version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, &show_version,
+ "Show version numbers", NULL},
+ {NULL}
+ };
+
+ context = g_option_context_new ("- [MODULE]...");
+ g_option_context_add_main_entries (context, entries, NULL);
+
+ if (!g_option_context_parse (context, &argc, &argv, &parse_error))
+ {
+ if (parse_error != NULL)
+ {
+ g_printerr("Parse option error: %s\n", parse_error->message);
+ }
+ else
+ {
+ g_printerr("Parse option error\n");
+ }
+ exit(1);
+ }
+
+ g_option_context_free(context);
+
g_type_init ();
g_printf ("# Pango Modules file\n"