summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2010-01-28 15:31:25 +0000
committerWerner Koch <wk@gnupg.org>2010-01-28 15:31:25 +0000
commit1a457c5bd649a82afd0c3567576660d9e653bb18 (patch)
tree3936a3354d7892190c9f8b1ea3916e1df7d2c481 /tests
parentc01cfaf2da8dacc4e6b1c1d1133237702276eb02 (diff)
downloadlibassuan-1a457c5bd649a82afd0c3567576660d9e653bb18.tar.gz
Cleanups for W32CE.
Implement getenv replacement for W32CE.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/common.h25
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, ...)
{