diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 4 | ||||
-rw-r--r-- | tests/common.h | 25 |
2 files changed, 26 insertions, 3 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 5d512c2..c243c27 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -25,7 +25,7 @@ EXTRA_DIST = motd BUILT_SOURCES = CLEANFILES = -TESTS = +TESTS = ce-server if USE_DESCRIPTOR_PASSING TESTS += fdpassing @@ -35,5 +35,5 @@ AM_CFLAGS = $(GPG_ERROR_CFLAGS) noinst_HEADERS = common.h noinst_PROGRAMS = $(TESTS) -LDADD = ../src/libassuan.la $(NETLIBS) $(GPG_ERROR_LIBS) +LDADD = ../src/libassuan.la $(NETLIBS) $(GPG_ERROR_LIBS) diff --git a/tests/common.h b/tests/common.h index 7a77807..3f2a848 100644 --- a/tests/common.h +++ b/tests/common.h @@ -19,19 +19,33 @@ #include <stdarg.h> +#ifdef HAVE_W32CE_SYSTEM +#define getpid() GetCurrentProcessId () +#define getenv(a) (NULL) +#endif + +#if HAVE_W32_SYSTEM +#define SOCKET2HANDLE(s) ((void *)(s)) +#define HANDLE2SOCKET(h) ((unsigned int)(h)) +#else +#define SOCKET2HANDLE(s) (s) +#define HANDLE2SOCKET(h) (h) +#endif + static const char *log_prefix; static int errorcount; static int verbose; static int debug; - void * xmalloc (size_t n) { char *p = malloc (n); if (!p) { + if (log_prefix) + fprintf (stderr, "%s[%u]: ", log_prefix, (unsigned int)getpid ()); fprintf (stderr, "out of core\n"); exit (1); } @@ -44,6 +58,8 @@ xcalloc (size_t n, size_t m) char *p = calloc (n, m); if (!p) { + if (log_prefix) + fprintf (stderr, "%s[%u]: ", log_prefix, (unsigned int)getpid ()); fprintf (stderr, "out of core\n"); exit (1); } @@ -69,6 +85,13 @@ log_set_prefix (const char *s) } +const char * +log_get_prefix (void) +{ + return log_prefix? log_prefix:""; +} + + void log_info (const char *format, ...) { |