[Pcsclite-cvs-commit] r6645 - /trunk/Drivers/ccid/src/debug.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Mon Jun 3 08:49:42 UTC 2013


Author: rousseau
Date: Mon Jun  3 08:49:42 2013
New Revision: 6645

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6645
Log:
Do not do colorization when not available.

Check code was missing in revision 6644.

Modified:
    trunk/Drivers/ccid/src/debug.c

Modified: trunk/Drivers/ccid/src/debug.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/debug.c?rev=6645&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/debug.c (original)
+++ trunk/Drivers/ccid/src/debug.c Mon Jun  3 08:49:42 2013
@@ -49,8 +49,8 @@
 	struct timeval new_time = { 0, 0 };
 	struct timeval tmp;
 	int delta;
-	const char *color_pfx = "", *color_sfx = "\33[0m";
-	const char *time_pfx = "\33[36m", *time_sfx = color_sfx;
+	const char *color_pfx = "", *color_sfx = "";
+	const char *time_pfx = "", *time_sfx = color_sfx;
 	static int initialized = 0;
 	static int LogDoColor = 0;
 
@@ -78,24 +78,30 @@
 		}
 	}
 
-	switch (priority)
+	if (LogDoColor)
 	{
-		case PCSC_LOG_CRITICAL:
-			color_pfx = "\33[01;31m"; /* bright + Red */
-			break;
+		color_sfx = "\33[0m";
+		time_pfx = "\33[36m";
 
-		case PCSC_LOG_ERROR:
-			color_pfx = "\33[35m"; /* Magenta */
-			break;
+		switch (priority)
+		{
+			case PCSC_LOG_CRITICAL:
+				color_pfx = "\33[01;31m"; /* bright + Red */
+				break;
 
-		case PCSC_LOG_INFO:
-			color_pfx = "\33[34m"; /* Blue */
-			break;
+			case PCSC_LOG_ERROR:
+				color_pfx = "\33[35m"; /* Magenta */
+				break;
 
-		case PCSC_LOG_DEBUG:
-			color_pfx = ""; /* normal (black) */
-			color_sfx = "";
-			break;
+			case PCSC_LOG_INFO:
+				color_pfx = "\33[34m"; /* Blue */
+				break;
+
+			case PCSC_LOG_DEBUG:
+				color_pfx = ""; /* normal (black) */
+				color_sfx = "";
+				break;
+		}
 	}
 
 	gettimeofday(&new_time, NULL);




More information about the Pcsclite-cvs-commit mailing list