2003-09-14 Marcus Brinkmann <marcus@g10code.de>
[gpgme.git] / tests / gpg / t-genkey.c
index 3a56b39..52bb99f 100644 (file)
@@ -1,4 +1,4 @@
-/* t-genkey.c  - regression test
+/* t-genkey.c - regression test
    Copyright (C) 2000 Werner Koch (dd9jn)
    Copyright (C) 2001, 2003 g10 Code GmbH
 
 
 #include <gpgme.h>
 
-#define fail_if_err(err)                                       \
-  do                                                           \
-    {                                                          \
-      if (err)                                                 \
-        {                                                      \
-          fprintf (stderr, "%s:%d: GpgmeError %s\n",           \
-                   __FILE__, __LINE__, gpgme_strerror (err));   \
-          exit (1);                                            \
-        }                                                      \
-    }                                                          \
-  while (0)
+#include "t-support.h"
 
+\f
 /* True if progress function printed something on the screen.  */
-int progress_called;
+static int progress_called;
 
 static void
 progress (void *self, const char *what, int type, int current, int total)
@@ -62,8 +53,8 @@ progress (void *self, const char *what, int type, int current, int total)
 int 
 main (int argc, char **argv)
 {
-  GpgmeCtx ctx;
-  GpgmeError err;
+  gpgme_ctx_t ctx;
+  gpgme_error_t err;
   const char *parms = "<GnupgKeyParms format=\"internal\">\n"
     "Key-Type: DSA\n"
     "Key-Length: 1024\n"
@@ -75,7 +66,9 @@ main (int argc, char **argv)
     "Expire-Date: 0\n"
     "Passphrase: abc\n"
     "</GnupgKeyParms>\n";
-  GpgmeGenKeyResult result;
+  gpgme_genkey_result_t result;
+
+  init_gpgme (GPGME_PROTOCOL_OpenPGP);
 
   err = gpgme_new (&ctx);
   fail_if_err (err);