diff libcommon/globalopts.c @ 34:91bcf84a5323

-p reader selection implemented in fc-pcsc-atr
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 12 Feb 2021 17:39:18 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libcommon/globalopts.c	Fri Feb 12 17:39:18 2021 +0000
@@ -0,0 +1,29 @@
+/*
+ * This module implements parsing of global command line options.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+extern unsigned select_reader_num;
+
+parse_global_options(argc, argv)
+	char **argv;
+{
+	extern char *optarg;
+	int c;
+
+	while ((c = getopt(argc, argv, "+p:")) != EOF) {
+		switch (c) {
+		case 'p':
+			select_reader_num = atoi(optarg);
+			continue;
+		case '?':
+		default:
+			/* error msg already printed */
+			exit(1);
+		}
+	}
+	return(0);
+}