2003-09-14 Marcus Brinkmann <marcus@g10code.de>

* gpg/t-import.c (main): Likewise.
	* gpg/t-keylist-sig.c (main): Likewise.
	* gpg/t-keylist.c (main): Likewise.
	* gpg/t-sign.c (main): Likewise.
	* gpg/t-signers.c (main): Likewise.
	* gpg/t-trustlist.c (main): Likewise.
	* gpgsm/t-support.h: Include <stdlib.h> and <locale.h>.
	(init_gpgme): New function.
	* gpg/t-support.h: Likewise.
	* gpgsm/t-verify.c (main): Call init_gpgme.
	* gpgsm/t-decrypt.c (main): Likewise.
	* gpgsm/t-encrypt.c (main): Likewise.
	* gpgsm/t-export.c (main): Likewise.
	* gpgsm/t-genkey.c (main): Likewise.
	* gpgsm/t-import.c (main): Likewise.
	* gpgsm/t-keylist.c (main): Likewise.
	* gpgsm/t-sign.c (main): Likewise.
	* gpg/t-verify.c (main): Call init_gpgme.
	* gpg/t-decrypt-verify.c (main): Likewise.
	* gpg/t-decrypt.c (main): Likewise.
	* gpg/t-edit.c (main): Likewise.
	* gpg/t-encrypt-sign.c (main): Likewise.
	* gpg/t-encrypt-sym.c (main): Likewise.
	* gpg/t-encrypt.c (main): Likewise.
	* gpg/t-eventloop.c (main): Likewise.
	* gpg/t-export.c (main): Likewise.
	* gpg/t-genkey.c (main): Likewise.
This commit is contained in:
Marcus Brinkmann 2003-09-14 00:30:53 +00:00
parent e4792cfb7d
commit f8867f2707
27 changed files with 103 additions and 41 deletions

View File

@ -1,3 +1,33 @@
2003-09-14 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-import.c (main): Likewise.
* gpg/t-keylist-sig.c (main): Likewise.
* gpg/t-keylist.c (main): Likewise.
* gpg/t-sign.c (main): Likewise.
* gpg/t-signers.c (main): Likewise.
* gpg/t-trustlist.c (main): Likewise.
* gpgsm/t-support.h: Include <stdlib.h> and <locale.h>.
(init_gpgme): New function.
* gpg/t-support.h: Likewise.
* gpgsm/t-verify.c (main): Call init_gpgme.
* gpgsm/t-decrypt.c (main): Likewise.
* gpgsm/t-encrypt.c (main): Likewise.
* gpgsm/t-export.c (main): Likewise.
* gpgsm/t-genkey.c (main): Likewise.
* gpgsm/t-import.c (main): Likewise.
* gpgsm/t-keylist.c (main): Likewise.
* gpgsm/t-sign.c (main): Likewise.
* gpg/t-verify.c (main): Call init_gpgme.
* gpg/t-decrypt-verify.c (main): Likewise.
* gpg/t-decrypt.c (main): Likewise.
* gpg/t-edit.c (main): Likewise.
* gpg/t-encrypt-sign.c (main): Likewise.
* gpg/t-encrypt-sym.c (main): Likewise.
* gpg/t-encrypt.c (main): Likewise.
* gpg/t-eventloop.c (main): Likewise.
* gpg/t-export.c (main): Likewise.
* gpg/t-genkey.c (main): Likewise.
2003-08-14 Marcus Brinkmann <marcus@g10code.de> 2003-08-14 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-sign.c (check_result): Change output format for signature * gpg/t-sign.c (check_result): Change output format for signature

View File

@ -98,6 +98,8 @@ main (int argc, char *argv[])
const char *cipher_2_asc = make_filename ("cipher-2.asc"); const char *cipher_2_asc = make_filename ("cipher-2.asc");
char *agent_info; char *agent_info;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);
@ -130,5 +132,3 @@ main (int argc, char *argv[])
gpgme_release (ctx); gpgme_release (ctx);
return 0; return 0;
} }

View File

@ -39,6 +39,8 @@ main (int argc, char *argv[])
const char *cipher_1_asc = make_filename ("cipher-1.asc"); const char *cipher_1_asc = make_filename ("cipher-1.asc");
char *agent_info; char *agent_info;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);

View File

@ -113,6 +113,8 @@ main (int argc, char **argv)
const char *pattern = "Alpha"; const char *pattern = "Alpha";
char *agent_info; char *agent_info;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);
err = gpgme_data_new (&out); err = gpgme_data_new (&out);
@ -141,5 +143,3 @@ main (int argc, char **argv)
return 0; return 0;
} }

View File

@ -86,8 +86,7 @@ main (int argc, char **argv)
gpgme_sign_result_t sign_result; gpgme_sign_result_t sign_result;
char *agent_info; char *agent_info;
err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
fail_if_err (err);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);

View File

@ -40,8 +40,7 @@ main (int argc, char *argv[])
char *p; char *p;
size_t len; size_t len;
err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
fail_if_err (err);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);
@ -90,5 +89,3 @@ main (int argc, char *argv[])
return 0; return 0;
} }

View File

@ -36,10 +36,7 @@ main (int argc, char *argv[])
gpgme_key_t key[3] = { NULL, NULL, NULL }; gpgme_key_t key[3] = { NULL, NULL, NULL };
gpgme_encrypt_result_t result; gpgme_encrypt_result_t result;
gpgme_check_version (0); init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP);
fail_if_err (err);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);

View File

@ -168,6 +168,8 @@ main (int argc, char *argv[])
gpgme_key_t key[3] = { NULL, NULL, NULL }; gpgme_key_t key[3] = { NULL, NULL, NULL };
int i; int i;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
for (i = 0; i < FDLIST_MAX; i++) for (i = 0; i < FDLIST_MAX; i++)
fdlist[i].fd = -1; fdlist[i].fd = -1;

View File

@ -36,6 +36,8 @@ main (int argc, char **argv)
gpgme_data_t out; gpgme_data_t out;
const char *pattern[] = { "Alpha", "Bob", NULL }; const char *pattern[] = { "Alpha", "Bob", NULL };
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);

View File

@ -68,6 +68,8 @@ main (int argc, char **argv)
"</GnupgKeyParms>\n"; "</GnupgKeyParms>\n";
gpgme_genkey_result_t result; gpgme_genkey_result_t result;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);

View File

@ -203,6 +203,8 @@ main (int argc, char *argv[])
const char *pubkey_1_asc = make_filename ("pubkey-1.asc"); const char *pubkey_1_asc = make_filename ("pubkey-1.asc");
const char *seckey_1_asc = make_filename ("seckey-1.asc"); const char *seckey_1_asc = make_filename ("seckey-1.asc");
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);

View File

@ -74,8 +74,7 @@ main (int argc, char **argv)
int mode; int mode;
int i = 0; int i = 0;
err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
fail_if_err (err);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);

View File

@ -113,8 +113,7 @@ main (int argc, char **argv)
gpgme_keylist_result_t result; gpgme_keylist_result_t result;
int i = 0; int i = 0;
err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP); init_gpgme (GPGME_PROTOCOL_OpenPGP);
fail_if_err (err);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);

View File

@ -84,6 +84,8 @@ main (int argc, char **argv)
gpgme_sign_result_t result; gpgme_sign_result_t result;
char *agent_info; char *agent_info;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);
@ -133,7 +135,3 @@ main (int argc, char **argv)
gpgme_release (ctx); gpgme_release (ctx);
return 0; return 0;
} }

View File

@ -96,6 +96,8 @@ main (int argc, char *argv[])
gpgme_sign_result_t result; gpgme_sign_result_t result;
char *agent_info; char *agent_info;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);

View File

@ -20,6 +20,8 @@
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <stdlib.h>
#include <locale.h>
#include <gpgme.h> #include <gpgme.h>
@ -79,3 +81,18 @@ make_filename (const char *fname)
strcat (buf, fname); strcat (buf, fname);
return buf; return buf;
} }
void
init_gpgme (gpgme_protocol_t proto)
{
gpgme_error_t err;
gpgme_check_version (NULL);
setlocale (LC_ALL, "");
gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL));
err = gpgme_engine_check_version (proto);
fail_if_err (err);
}

View File

@ -34,6 +34,8 @@ main (int argc, char *argv[])
gpgme_error_t err; gpgme_error_t err;
gpgme_trust_item_t item; gpgme_trust_item_t item;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);

View File

@ -151,6 +151,8 @@ main (int argc, char *argv[])
gpgme_data_t sig, text; gpgme_data_t sig, text;
gpgme_verify_result_t result; gpgme_verify_result_t result;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);

View File

@ -49,6 +49,8 @@ main (int argc, char *argv[])
gpgme_data_t in, out; gpgme_data_t in, out;
gpgme_decrypt_result_t result; gpgme_decrypt_result_t result;
init_gpgme (GPGME_PROTOCOL_CMS);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);
gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);
@ -75,5 +77,3 @@ main (int argc, char *argv[])
gpgme_release (ctx); gpgme_release (ctx);
return 0; return 0;
} }

View File

@ -35,8 +35,7 @@ main (int argc, char **argv)
gpgme_key_t key[] = { NULL, NULL }; gpgme_key_t key[] = { NULL, NULL };
gpgme_encrypt_result_t result; gpgme_encrypt_result_t result;
err = gpgme_engine_check_version (GPGME_PROTOCOL_CMS); init_gpgme (GPGME_PROTOCOL_CMS);
fail_if_err (err);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);

View File

@ -34,6 +34,9 @@ main (int argc, char *argv[])
gpgme_error_t err; gpgme_error_t err;
gpgme_data_t out; gpgme_data_t out;
const char *pattern[] = { "DFN Top Level Certification Authority", NULL }; const char *pattern[] = { "DFN Top Level Certification Authority", NULL };
init_gpgme (GPGME_PROTOCOL_CMS);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);
gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);

View File

@ -64,8 +64,7 @@ main (int argc, char *argv[])
gpgme_genkey_result_t result; gpgme_genkey_result_t result;
gpgme_data_t certreq; gpgme_data_t certreq;
err = gpgme_engine_check_version (GPGME_PROTOCOL_CMS); init_gpgme (GPGME_PROTOCOL_CMS);
fail_if_err (err);
err = gpgme_data_new (&certreq); err = gpgme_data_new (&certreq);
fail_if_err (err); fail_if_err (err);

View File

@ -161,8 +161,7 @@ main (int argc, char **argv)
const char *cert_1 = make_filename ("cert_dfn_pca01.der"); const char *cert_1 = make_filename ("cert_dfn_pca01.der");
const char *cert_2 = make_filename ("cert_dfn_pca15.der"); const char *cert_2 = make_filename ("cert_dfn_pca15.der");
err = gpgme_engine_check_version (GPGME_PROTOCOL_CMS); init_gpgme (GPGME_PROTOCOL_CMS);
fail_if_err (err);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);

View File

@ -82,8 +82,7 @@ main (int argc, char **argv)
gpgme_keylist_result_t result; gpgme_keylist_result_t result;
int i = 0; int i = 0;
err = gpgme_engine_check_version (GPGME_PROTOCOL_CMS); init_gpgme (GPGME_PROTOCOL_CMS);
fail_if_err (err);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);

View File

@ -81,8 +81,7 @@ main (int argc, char *argv[])
gpgme_data_t in, out; gpgme_data_t in, out;
gpgme_sign_result_t result; gpgme_sign_result_t result;
err = gpgme_engine_check_version (GPGME_PROTOCOL_CMS); init_gpgme (GPGME_PROTOCOL_CMS);
fail_if_err (err);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);
@ -119,7 +118,3 @@ main (int argc, char *argv[])
gpgme_release (ctx); gpgme_release (ctx);
return 0; return 0;
} }

View File

@ -20,6 +20,8 @@
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <stdlib.h>
#include <locale.h>
#include <gpgme.h> #include <gpgme.h>
@ -79,3 +81,18 @@ make_filename (const char *fname)
strcat (buf, fname); strcat (buf, fname);
return buf; return buf;
} }
void
init_gpgme (gpgme_protocol_t proto)
{
gpgme_error_t err;
gpgme_check_version (NULL);
setlocale (LC_ALL, "");
gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL));
err = gpgme_engine_check_version (proto);
fail_if_err (err);
}

View File

@ -119,6 +119,8 @@ main (int argc, char **argv)
gpgme_data_t sig, text; gpgme_data_t sig, text;
gpgme_verify_result_t result; gpgme_verify_result_t result;
init_gpgme (GPGME_PROTOCOL_CMS);
err = gpgme_new (&ctx); err = gpgme_new (&ctx);
fail_if_err (err); fail_if_err (err);
gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);
@ -150,6 +152,3 @@ main (int argc, char **argv)
gpgme_release (ctx); gpgme_release (ctx);
return 0; return 0;
} }