diff options
author | Werner Koch <[email protected]> | 2012-09-25 13:38:26 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2012-09-25 13:38:26 +0000 |
commit | c62b79a1d6e576d94e08cb81c2f5dbcb42ecf8cf (patch) | |
tree | 0c659d95d2a93943c65f86e2d8e626ad335081c8 /src/gpgme.c | |
parent | Remove all trailing whitespace from source files (diff) | |
download | gpgme-c62b79a1d6e576d94e08cb81c2f5dbcb42ecf8cf.tar.gz gpgme-c62b79a1d6e576d94e08cb81c2f5dbcb42ecf8cf.zip |
Add gpgme_set_global_flag to help debugging
* src/gpgme.c (gpgme_set_global_flag): New.
* src/gpgme.h.in (gpgme_set_global_flag): New.
* src/gpgme.def, src/libgpgme.vers: Add new public function.
* src/debug.c (envvar_override): New.:
(_gpgme_debug_set_debug_envvar): New.
(debug_init): Take ENVVAR_OVERRIDE in account.
--
On Android envvars can't be used, thus we need another way to enable
GPGME debugging. The new function allows this and may be used in the
future to implement similar things.
Diffstat (limited to 'src/gpgme.c')
-rw-r--r-- | src/gpgme.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/gpgme.c b/src/gpgme.c index 771fcc00..2c6ac875 100644 --- a/src/gpgme.c +++ b/src/gpgme.c @@ -1,6 +1,6 @@ /* gpgme.c - GnuPG Made Easy. Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 g10 Code GmbH + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2012 g10 Code GmbH This file is part of GPGME. @@ -52,6 +52,25 @@ gpgme_error_t _gpgme_selftest = GPG_ERR_NOT_OPERATIONAL; DEFINE_STATIC_LOCK (result_ref_lock); +/* Set the global flag NAME to VALUE. Return 0 on success. Note that + this function does use gpgme_error and thus a non-zero return value + merely means "error". Certain flags may be set before + gpgme_check_version is called. See the manual for a description of + supported flags. The caller must assure that this function is + called only by one thread at a time. */ +int +gpgme_set_global_flag (const char *name, const char *value) +{ + if (!name || !value) + return -1; + else if (!strcmp (name, "debug")) + return _gpgme_debug_set_debug_envvar (value); + else + return -1; +} + + + /* Create a new context as an environment for GPGME crypto operations. */ gpgme_error_t |