[libgdata] demos: Return a useful exit code from the docs-list demo



commit c0ce3fb33569f4af08a3bfd32a825893f3f05818
Author: Philip Withnall <withnall endlessm com>
Date:   Fri Feb 3 16:36:04 2017 +0000

    demos: Return a useful exit code from the docs-list demo

 demos/docs-list/docs-list.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/demos/docs-list/docs-list.c b/demos/docs-list/docs-list.c
index 44ef28b..85e0e1e 100644
--- a/demos/docs-list/docs-list.c
+++ b/demos/docs-list/docs-list.c
@@ -41,6 +41,7 @@ main (void)
        GList *entries;
        GList *l;
        GoaClient *client = NULL;
+       gint retval;
 
        setlocale (LC_ALL, "");
 
@@ -48,6 +49,7 @@ main (void)
        if (error != NULL) {
                g_warning ("%s", error->message);
                g_error_free (error);
+               retval = 1;
                goto out;
        }
 
@@ -71,6 +73,7 @@ main (void)
 
        if (service == NULL) {
                g_warning ("Account not found");
+               retval = 1;
                goto out;
        }
 
@@ -82,11 +85,13 @@ main (void)
                if (error != NULL) {
                        g_warning ("%s", error->message);
                        g_error_free (error);
+                       retval = 1;
                        goto out;
                }
 
                entries = gdata_feed_get_entries (GDATA_FEED (feed));
                if (entries == NULL) {
+                       retval = 0;
                        goto out;
                }
 
@@ -102,6 +107,8 @@ main (void)
                g_object_unref (feed);
        }
 
+       retval = 0;
+
 out:
        g_clear_object (&feed);
        g_clear_object (&query);
@@ -109,5 +116,5 @@ out:
        g_clear_object (&client);
        g_list_free_full (accounts, g_object_unref);
 
-       return 0;
+       return retval;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]