[Pcsclite-cvs-commit] r4329 - /trunk/HandlerTest/Host/handler_test.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Jul 21 07:42:45 UTC 2009


Author: rousseau
Date: Tue Jul 21 07:42:43 2009
New Revision: 4329

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4329
Log:
use #define for the color codes

Modified:
    trunk/HandlerTest/Host/handler_test.c

Modified: trunk/HandlerTest/Host/handler_test.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/HandlerTest/Host/handler_test.c?rev=4329&op=diff
==============================================================================
--- trunk/HandlerTest/Host/handler_test.c (original)
+++ trunk/HandlerTest/Host/handler_test.c Tue Jul 21 07:42:43 2009
@@ -84,6 +84,10 @@
 #define CASE2 (1<<1)
 #define CASE3 (1<<2)
 #define CASE4 (1<<3)
+
+#define RED "\33[01;31m"
+#define BLUE "\33[01;34m"
+#define NORMAL "\33[0m\n"
 
 /* flags */
 char full = FALSE;
@@ -204,14 +208,14 @@
 
 	if (NULL == driver)
 	{
-		printf("\33[01;31mUse -l libname or define " ENV_LIBNAME "\33[0m\n");
+		printf(RED "Use -l libname or define " ENV_LIBNAME NORMAL);
 		help(argv[0]);
 		return 2;
 	}
 
 	if ((FALSE == tpdu) && (FALSE == apdu))
 	{
-		printf("\33[01;31mDefine TPDU (-T) or APDU (-A)\33[0m\n");
+		printf(RED "Define TPDU (-T) or APDU (-A)" NORMAL);
 		help(argv[0]);
 		return 2;
 	}
@@ -380,9 +384,9 @@
 	printf("\n");
 
 	if (test_rv)
-		printf("\33[01;31m***********\n*  ERROR  *\n***********\33[0m\n");
+		printf(RED "***********\n*  ERROR  *\n***********" NORMAL);
 	else
-		printf("\33[01;34m***********\n*   OK    *\n***********\33[0m\n");
+		printf(BLUE "***********\n*   OK    *\n***********" NORMAL);
 
 	return 0;
 } /* handler_test */
@@ -989,7 +993,7 @@
 	/* check the received length */
 	if (*r_length != e_length)
 	{
-		printf("\33[01;31mERROR: Expected %d bytes and received %ld\33[0m\n",
+		printf(RED "ERROR: Expected %d bytes and received %ld" NORMAL,
 			e_length, *r_length);
 		if (stop_on_error)
 			return 1;
@@ -1000,7 +1004,7 @@
 	for (i=0; i<e_length; i++)
 		if (r[i] != e[i])
 		{
-			printf("\33[01;31mERROR byte %d: expected 0x%02X, got 0x%02X\n\33[0m",
+			printf(RED "ERROR byte %d: expected 0x%02X, got 0x%02X\n" NORMAL,
 				i, e[i], r[i]);
 			if (stop_on_error)
 				return 1;




More information about the Pcsclite-cvs-commit mailing list