[Pcsclite-cvs-commit] r4241 - /trunk/PCSC/src/debuglog.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Tue Jun 2 13:50:53 UTC 2009
Author: rousseau
Date: Tue Jun 2 13:50:52 2009
New Revision: 4241
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4241
Log:
log APDU and SW (--apdu) even if --debug is not used
Modified:
trunk/PCSC/src/debuglog.c
Modified: trunk/PCSC/src/debuglog.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/debuglog.c?rev=4241&op=diff
==============================================================================
--- trunk/PCSC/src/debuglog.c (original)
+++ trunk/PCSC/src/debuglog.c Tue Jun 2 13:50:52 2009
@@ -128,35 +128,41 @@
}
} /* log_msg */
-void log_xxd(const int priority, const char *msg, const unsigned char *buffer,
- const int len)
+static void log_xxd_always(const int priority, const char *msg,
+ const unsigned char *buffer, const int len)
{
char DebugBuffer[DEBUG_BUF_SIZE];
int i;
char *c;
char *debug_buf_end;
+ debug_buf_end = DebugBuffer + DEBUG_BUF_SIZE - 5;
+
+ strlcpy(DebugBuffer, msg, sizeof(DebugBuffer));
+ c = DebugBuffer + strlen(DebugBuffer);
+
+ for (i = 0; (i < len) && (c < debug_buf_end); ++i)
+ {
+ sprintf(c, "%02X ", buffer[i]);
+ c += 3;
+ }
+
+ /* the buffer is too small so end it with "..." */
+ if ((c >= debug_buf_end) && (i < len))
+ c[-3] = c[-2] = c[-1] = '.';
+
+ log_line(priority, DebugBuffer);
+} /* log_xxd_always */
+
+void log_xxd(const int priority, const char *msg, const unsigned char *buffer,
+ const int len)
+{
if ((LogSuppress != DEBUGLOG_LOG_ENTRIES)
|| (priority < LogLevel) /* log priority lower than threshold? */
|| (DEBUGLOG_NO_DEBUG == LogMsgType))
return;
- debug_buf_end = DebugBuffer + DEBUG_BUF_SIZE - 5;
-
- strlcpy(DebugBuffer, msg, sizeof(DebugBuffer));
- c = DebugBuffer + strlen(DebugBuffer);
-
- for (i = 0; (i < len) && (c < debug_buf_end); ++i)
- {
- sprintf(c, "%02X ", buffer[i]);
- c += 3;
- }
-
- /* the buffer is too small so end it with "..." */
- if ((c >= debug_buf_end) && (i < len))
- c[-3] = c[-2] = c[-1] = '.';
-
- log_line(priority, DebugBuffer);
+ log_xxd_always(priority, msg, buffer, len);
} /* log_xxd */
#ifdef PCSCD
@@ -260,11 +266,11 @@
{
if ((category & DEBUG_CATEGORY_APDU)
&& (LogCategory & DEBUG_CATEGORY_APDU))
- log_xxd(PCSC_LOG_INFO, "APDU: ", (const unsigned char *)buffer, len);
+ log_xxd_always(PCSC_LOG_INFO, "APDU: ", buffer, len);
if ((category & DEBUG_CATEGORY_SW)
&& (LogCategory & DEBUG_CATEGORY_APDU))
- log_xxd(PCSC_LOG_INFO, "SW: ", (const unsigned char *)buffer, len);
+ log_xxd_always(PCSC_LOG_INFO, "SW: ", buffer, len);
}
/*
More information about the Pcsclite-cvs-commit
mailing list