aboutsummaryrefslogtreecommitdiffstats
path: root/src/assuan-buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/assuan-buffer.c')
-rw-r--r--src/assuan-buffer.c65
1 files changed, 27 insertions, 38 deletions
diff --git a/src/assuan-buffer.c b/src/assuan-buffer.c
index bbe3990..59518f2 100644
--- a/src/assuan-buffer.c
+++ b/src/assuan-buffer.c
@@ -1,5 +1,5 @@
/* assuan-buffer.c - read and send data
- * Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
*
* This file is part of Assuan.
*
@@ -27,22 +27,6 @@
#include <assert.h>
#include "assuan-defs.h"
-#ifdef HAVE_JNLIB_LOGGING
-#include "../jnlib/logging.h"
-#endif
-
-
-static const char *
-my_log_prefix (void)
-{
-#ifdef HAVE_JNLIB_LOGGING
- return log_get_prefix (NULL);
-#else
- return "";
-#endif
-}
-
-
static int
writen (ASSUAN_CONTEXT ctx, const char *buffer, size_t length)
{
@@ -141,16 +125,17 @@ _assuan_read_line (ASSUAN_CONTEXT ctx)
if (rc)
{
if (ctx->log_fp)
- fprintf (ctx->log_fp, "%s[%p] <- [Error: %s]\n",
- my_log_prefix (), ctx, strerror (errno));
+ fprintf (ctx->log_fp, "%s[%p] <- [Error: %s]\n",
+ assuan_get_assuan_log_prefix (), ctx, strerror (errno));
return ASSUAN_Read_Error;
}
if (!nread)
{
assert (ctx->inbound.eof);
if (ctx->log_fp)
- fprintf (ctx->log_fp, "%s[%p] <- [EOF]\n", my_log_prefix (),ctx);
- return -1;
+ fprintf (ctx->log_fp, "%s[%p] <- [EOF]\n",
+ assuan_get_assuan_log_prefix (), ctx);
+ return -1;
}
ctx->inbound.attic.pending = 0;
@@ -180,11 +165,12 @@ _assuan_read_line (ASSUAN_CONTEXT ctx)
ctx->inbound.linelen = endp - line;
if (ctx->log_fp)
{
- fprintf (ctx->log_fp, "%s[%p] <- ", my_log_prefix (), ctx);
+ fprintf (ctx->log_fp, "%s[%p] <- ",
+ assuan_get_assuan_log_prefix (), ctx);
if (ctx->confidential)
fputs ("[Confidential data not shown]", ctx->log_fp);
else
- _assuan_log_print_buffer (ctx->log_fp,
+ _assuan_log_print_buffer (ctx->log_fp,
ctx->inbound.line,
ctx->inbound.linelen);
putc ('\n', ctx->log_fp);
@@ -195,7 +181,7 @@ _assuan_read_line (ASSUAN_CONTEXT ctx)
{
if (ctx->log_fp)
fprintf (ctx->log_fp, "%s[%p] <- [Invalid line]\n",
- my_log_prefix (), ctx);
+ assuan_get_assuan_log_prefix (), ctx);
*line = 0;
ctx->inbound.linelen = 0;
return ctx->inbound.eof ? ASSUAN_Line_Not_Terminated
@@ -255,13 +241,14 @@ assuan_write_line (ASSUAN_CONTEXT ctx, const char *line)
/* fixme: we should do some kind of line buffering. */
if (ctx->log_fp)
{
- fprintf (ctx->log_fp, "%s[%p] -> ", my_log_prefix (), ctx);
+ fprintf (ctx->log_fp, "%s[%p] -> ",
+ assuan_get_assuan_log_prefix (), ctx);
if (s)
- fputs ("[supplied line contained a LF]", ctx->log_fp);
+ fputs ("[supplied line contained a LF]", ctx->log_fp);
if (ctx->confidential)
- fputs ("[Confidential data not shown]", ctx->log_fp);
+ fputs ("[Confidential data not shown]", ctx->log_fp);
else
- _assuan_log_print_buffer (ctx->log_fp, line, len);
+ _assuan_log_print_buffer (ctx->log_fp, line, len);
putc ('\n', ctx->log_fp);
}
@@ -327,7 +314,9 @@ _assuan_cookie_write_data (void *cookie, const char *buffer, size_t size)
{
if (ctx->log_fp)
{
- fprintf (ctx->log_fp, "%s[%p] -> ", my_log_prefix (), ctx);
+ fprintf (ctx->log_fp, "%s[%p] -> ",
+ assuan_get_assuan_log_prefix (), ctx);
+
if (ctx->confidential)
fputs ("[Confidential data not shown]", ctx->log_fp);
else
@@ -371,15 +360,15 @@ _assuan_cookie_write_flush (void *cookie)
if (linelen)
{
if (ctx->log_fp)
- {
- fprintf (ctx->log_fp, "%s[%p] -> ", my_log_prefix (), ctx);
- if (ctx->confidential)
- fputs ("[Confidential data not shown]", ctx->log_fp);
- else
- _assuan_log_print_buffer (ctx->log_fp,
- ctx->outbound.data.line,
- linelen);
- putc ('\n', ctx->log_fp);
+ {
+ fprintf (ctx->log_fp, "%s[%p] -> ",
+ assuan_get_assuan_log_prefix (), ctx);
+ if (ctx->confidential)
+ fputs ("[Confidential data not shown]", ctx->log_fp);
+ else
+ _assuan_log_print_buffer (ctx->log_fp,
+ ctx->outbound.data.line, linelen);
+ putc ('\n', ctx->log_fp);
}
*line++ = '\n';
linelen++;