Update the example to demonstrate error handling. (#497033, Matti Katila)
authorMatthias Clasen <mclasen@redhat.com>
Mon, 19 Nov 2007 03:50:16 +0000 (03:50 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 19 Nov 2007 03:50:16 +0000 (03:50 +0000)
2007-11-18  Matthias Clasen <mclasen@redhat.com>

        * glib/tmpl/option.sgml: Update the example to demonstrate
        error handling.  (#497033, Matti Katila)

svn path=/trunk/; revision=5865

docs/reference/ChangeLog
docs/reference/glib/tmpl/option.sgml

index cf4685d84cd4dc85dece697991009236d1221e6b..18ed8f0ba19c9735446b25d2e585930d4e6760b3 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-18  Matthias Clasen <mclasen@redhat.com>
+
+       * glib/tmpl/option.sgml: Update the example to demonstrate
+       error handling.  (#497033, Matti Katila)
+
 2007-11-09  Matthias Clasen <mclasen@redhat.com>
 
        * glib/tmpl/patterns.sgml: Add a warning about strlen vs
index 9dc78ead95d25538ae28e44f4413ceffe68ae3d7..30757bc74f92b34a2252f8ef18e2ab906be4e94c 100644 (file)
@@ -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, &amp;argc, &amp;argv, &amp;error);
-  
+  if (!g_option_context_parse (context, &amp;argc, &amp;argv, &amp;error))
+    {
+      g_print ("option parsing failed: %s\n", error->message);
+      exit (1);
+    }
+
   /* ... */
 
 }