FreeCalypso > hg > fc-sim-tools
annotate pcsc/rdselect.c @ 103:3477438b5706 default tip
new fc-simtool command script: oper-sim-test
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 06 Aug 2022 16:34:43 +0000 |
parents | f7a03e53bb2c |
children |
rev | line source |
---|---|
1
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 #include <stdio.h> |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 #include <stdlib.h> |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 #include <unistd.h> |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 unsigned select_reader_num; |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 parse_reader_select_opt(argc, argv) |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 char **argv; |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 { |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 extern char *optarg; |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 int c; |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 while ((c = getopt(argc, argv, "p:")) != EOF) { |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 switch (c) { |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 case 'p': |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 select_reader_num = atoi(optarg); |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 continue; |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 case '?': |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 default: |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 /* error msg already printed */ |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 exit(1); |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 } |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 } |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 return(0); |
f7a03e53bb2c
fc-pcsc-atr ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 } |