FreeCalypso > hg > fc-sim-tools
comparison libcommon/globalopts.c @ 9:c9ef9e91dd8e
new libcommon, initial version
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Sun, 14 Mar 2021 06:55:38 +0000 |
| parents | |
| children | 9eb5460f51a6 |
comparison
equal
deleted
inserted
replaced
| 8:34bbb0585cab | 9:c9ef9e91dd8e |
|---|---|
| 1 /* | |
| 2 * This module implements parsing of global command line options. | |
| 3 */ | |
| 4 | |
| 5 #include <stdio.h> | |
| 6 #include <stdlib.h> | |
| 7 #include <unistd.h> | |
| 8 | |
| 9 unsigned calypso_fd, pcsc_reader_num; | |
| 10 | |
| 11 parse_global_options(argc, argv) | |
| 12 char **argv; | |
| 13 { | |
| 14 extern char *optarg; | |
| 15 int c; | |
| 16 | |
| 17 while ((c = getopt(argc, argv, "+C:p:")) != EOF) { | |
| 18 switch (c) { | |
| 19 case 'C': | |
| 20 calypso_fd = atoi(optarg); | |
| 21 continue; | |
| 22 case 'p': | |
| 23 pcsc_reader_num = atoi(optarg); | |
| 24 continue; | |
| 25 case '?': | |
| 26 default: | |
| 27 /* error msg already printed */ | |
| 28 exit(1); | |
| 29 } | |
| 30 } | |
| 31 return(0); | |
| 32 } |
