From: Werner Koch Date: Thu, 7 Oct 2010 10:58:51 +0000 (+0000) Subject: Enable debugging feature for W32CE. X-Git-Tag: gpgme-1.3.1~41 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c2ef39811db27cb28d9ce0eafc64c82d0f66df82;p=gpgme.git Enable debugging feature for W32CE. kFreeBSD portability fix. --- diff --git a/src/ChangeLog b/src/ChangeLog index 311764f..50b0b68 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2010-10-07 Werner Koch + + * gpgme-tool.c (ARGP_ERR_UNKNOWN): Use EDEADLK if available. + + * w32-util.c (_gpgme_w32ce_get_debug_envvar) [W32CE]: New. + * debug.c (debug_init) [W32CE]: Use new function. + 2010-09-16 Werner Koch * import.c: Include "util.h". diff --git a/src/debug.c b/src/debug.c index e51ece6..6faf4aa 100644 --- a/src/debug.c +++ b/src/debug.c @@ -115,12 +115,16 @@ debug_init (void) char *e; const char *s1, *s2;; +#ifdef HAVE_W32CE_SYSTEM + e = _gpgme_w32ce_get_debug_envvar (); +#else /*!HAVE_W32CE_SYSTEM*/ err = _gpgme_getenv ("GPGME_DEBUG", &e); if (err) { UNLOCK (debug_lock); return; } +#endif /*!HAVE_W32CE_SYSTEM*/ initialized = 1; errfp = stderr; diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c index da2b6ec..068681f 100644 --- a/src/gpgme-tool.c +++ b/src/gpgme-tool.c @@ -109,7 +109,11 @@ struct argp_state void *pstate; }; -#define ARGP_ERR_UNKNOWN EDEADLOCK +#ifdef EDEADLK +# define ARGP_ERR_UNKNOWN EDEADLK /* POSIX */ +#else +# define ARGP_ERR_UNKNOWN EDEADLOCK /* *GNU/kFreebsd does not define this) */ +#endif #define ARGP_KEY_ARG 0 #define ARGP_KEY_ARGS 0x1000006 #define ARGP_KEY_END 0x1000001 diff --git a/src/util.h b/src/util.h index 9965847..f7e6d27 100644 --- a/src/util.h +++ b/src/util.h @@ -127,7 +127,10 @@ gpgme_error_t _gpgme_getenv (const char *name, char **value); #ifdef HAVE_W32_SYSTEM int _gpgme_mkstemp (int *fd, char **name); const char *_gpgme_get_w32spawn_path (void); -#endif +#endif /*HAVE_W32_SYSTEM*/ +#ifdef HAVE_W32CE_SYSTEM +char *_gpgme_w32ce_get_debug_envvar (void); +#endif /*HAVE_W32CE_SYSTEM*/ /*-- Error codes not yet available in current gpg-error.h. --*/ #ifndef GPG_ERR_UNFINISHED diff --git a/src/w32-util.c b/src/w32-util.c index 22c2a0f..afac679 100644 --- a/src/w32-util.c +++ b/src/w32-util.c @@ -588,3 +588,24 @@ _gpgme_mkstemp (int *fd, char **name) *name = tmpname; return 0; } + + + +#ifdef HAVE_W32CE_SYSTEM +/* Return a malloced string with the replacement value for the + GPGME_DEBUG envvar. Caller must release. Returns NULL if not + set. */ +char * +_gpgme_w32ce_get_debug_envvar (void) +{ + char *tmp; + + tmp = w32_read_registry (L"\\Software\\GNU\\gpgme", L"debug"); + if (tmp && !*tmp) + { + free (tmp); + tmp = NULL; + } + return NULL; +} +#endif /*HAVE_W32CE_SYSTEM*/