From: Matthias Clasen Date: Mon, 19 Nov 2007 03:50:16 +0000 (+0000) Subject: Update the example to demonstrate error handling. (#497033, Matti Katila) X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=5b918f8ddc3916d74f5cd7aecea12bb890f15d4b;p=dana%2Fcg-glib.git Update the example to demonstrate error handling. (#497033, Matti Katila) 2007-11-18 Matthias Clasen * glib/tmpl/option.sgml: Update the example to demonstrate error handling. (#497033, Matti Katila) svn path=/trunk/; revision=5865 --- diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index cf4685d8..18ed8f0b 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,8 @@ +2007-11-18 Matthias Clasen + + * glib/tmpl/option.sgml: Update the example to demonstrate + error handling. (#497033, Matti Katila) + 2007-11-09 Matthias Clasen * glib/tmpl/patterns.sgml: Add a warning about strlen vs diff --git a/docs/reference/glib/tmpl/option.sgml b/docs/reference/glib/tmpl/option.sgml index 9dc78ead..30757bc7 100644 --- a/docs/reference/glib/tmpl/option.sgml +++ b/docs/reference/glib/tmpl/option.sgml @@ -114,8 +114,12 @@ main (int argc, char *argv[]) context = g_option_context_new ("- test tree model performance"); g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); g_option_context_add_group (context, gtk_get_option_group (TRUE)); - g_option_context_parse (context, &argc, &argv, &error); - + if (!g_option_context_parse (context, &argc, &argv, &error)) + { + g_print ("option parsing failed: %s\n", error->message); + exit (1); + } + /* ... */ }