FreeCalypso > hg > fc-sim-tools
view libcommon/globalopts.c @ 99:97ba63d9361a
scripts/fcsim1-sst: turn off STK & OTA services
In the initial unprogrammed state of the cards from Grcard, SST has
services 25 through 29 set to allocated and activated. However,
these cards appear to not actually support OTA, ENVELOPE commands
do nothing (just return SW 9000), and they were never observed
issuing any proactive SIM commands, even after a feature-generous
TERMINAL PROFILE. Therefore, let's list these STK & OTA services
as allocated, but not activated in our FCSIM1 SST.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 05 May 2021 04:26:07 +0000 |
parents | 9eb5460f51a6 |
children |
line wrap: on
line source
/* * This module implements parsing of global command line options. */ #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> unsigned calypso_fd, pcsc_reader_num, serial_spenh; int use_pcsc; char *serial_device, *serial_baud; parse_global_options(argc, argv) char **argv; { extern char *optarg; int c; while ((c = getopt(argc, argv, "+b:C:d:e:p:")) != EOF) { switch (c) { case 'b': serial_baud = optarg; continue; case 'C': calypso_fd = atoi(optarg); continue; case 'd': serial_device = optarg; continue; case 'e': if (!isdigit(optarg[0]) || optarg[1]) { bad_minus_e: fprintf(stderr, "error: bad -e argument\n"); exit(1); } serial_spenh = optarg[0] - '0'; switch (serial_spenh) { case 1: case 2: case 4: case 8: break; default: goto bad_minus_e; } continue; case 'p': use_pcsc = 1; pcsc_reader_num = atoi(optarg); continue; case '?': default: /* error msg already printed */ exit(1); } } if (serial_device && use_pcsc) { fprintf(stderr, "error: -d and -p target selection options are mutually exclusive\n"); exit(1); } if (!serial_device && (serial_baud || serial_spenh)) { fprintf(stderr, "error: -b and -e options are meaningless without -d\n"); exit(1); } if (serial_baud && serial_spenh) { fprintf(stderr, "error: -b and -e options are mutually exclusive\n"); exit(1); } return(0); }