[Pcsclite-cvs-commit] HandlerTest/Host handler_test.c,1.8,1.9

rousseau@quantz.debian.org rousseau@quantz.debian.org
Mon, 09 Feb 2004 14:28:36 +0100


Update of /cvsroot/pcsclite/HandlerTest/Host
In directory quantz:/tmp/cvs-serv15038

Modified Files:
	handler_test.c 
Log Message:
allow to pass a device_name starting by numbers by explicitely selected a channel


Index: handler_test.c
===================================================================
RCS file: /cvsroot/pcsclite/HandlerTest/Host/handler_test.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- handler_test.c	9 Feb 2004 08:35:55 -0000	1.8
+++ handler_test.c	9 Feb 2004 13:28:33 -0000	1.9
@@ -195,12 +195,23 @@
 	}
 	else
 	{
-		// channel
-		if (argc - optind >= 1)
+		switch (argc - optind)
 		{
-			channel = atoi(argv[optind]);
-			if (channel == 0)
-				device_name = argv[optind];
+			// channel or device_name
+			case 1:
+				channel = atoi(argv[optind]);
+				if (channel == 0)
+					device_name = argv[optind];
+				break;
+
+			// channel and device_name
+			case 2:
+				channel = atoi(argv[optind]);
+				device_name = argv[optind+1];
+				break;
+
+			default:
+				help(argv[0]);
 		}
 	}