Enable debugging feature for W32CE.

kFreeBSD portability fix.
This commit is contained in:
Werner Koch 2010-10-07 10:58:51 +00:00
parent b927279603
commit c2ef39811d
5 changed files with 41 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2010-10-07 Werner Koch <wk@g10code.com>
* 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 <wk@g10code.com>
* import.c: Include "util.h".

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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*/