autoreconf
[moonshot-ui.git] / examples / service-selection.c
index 2acb743..48122be 100644 (file)
@@ -1,10 +1,11 @@
-#include <glib.h>
-#include "libmoonshot.h"
+#include <libmoonshot.h>
+
+#include <stdio.h>
 
 int main (int argc, char *argv[])
 {
-    MoonshotError *error;
-    gboolean        success;
+    MoonshotError *error = NULL;
+    int success;
 
     char *nai,
          *password,
@@ -24,14 +25,19 @@ int main (int argc, char *argv[])
                                      &subject_alt_name_constraint,
                                      &error);
 
-    if (success)
-        g_debug ("Got id: %s %s\n", nai, password);
+    if (success) {
+        printf ("Got identity: %s %s %s\n", nai, password, server_certificate_hash);
 
+        moonshot_free (nai);
+        moonshot_free (password);
+        moonshot_free (server_certificate_hash);
+        moonshot_free (ca_certificate);
+        moonshot_free (subject_name_constraint);
+        moonshot_free (subject_alt_name_constraint);
 
-    moonshot_free (nai);
-    moonshot_free (password);
-    moonshot_free (server_certificate_hash);
-    moonshot_free (ca_certificate);
-    moonshot_free (subject_name_constraint);
-    moonshot_free (subject_alt_name_constraint);
+        return 0;
+    } else {
+        printf ("Error: %s\n", error->message);
+        return 1;
+    }
 }