diff --git a/src/ChangeLog b/src/ChangeLog index 311764fc..50b0b689 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 e51ece68..6faf4aaf 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 da2b6ec9..068681f6 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 9965847f..f7e6d276 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 22c2a0f3..afac6795 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*/