FreeCalypso > hg > fc-sim-tools
view libutil/hexread.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 | 34bbb0585cab |
children |
line wrap: on
line source
/* * This module contains the function for reading hex files, * to be used in the implementation of manual write commands. */ #include <sys/types.h> #include <ctype.h> #include <stdio.h> #include <stdlib.h> extern FILE *open_script_input_file(); read_hex_data_file(filename, databuf, maxlen) char *filename; u_char *databuf; unsigned maxlen; { FILE *inf; unsigned count; int c, c2; inf = open_script_input_file(filename); if (!inf) { perror(filename); return(-1); } for (count = 0; ; ) { do c = getc(inf); while (isspace(c)); if (c < 0) break; if (c == '#') { do c = getc(inf); while (c >= 0 && c != '\n'); continue; } if (!isxdigit(c)) { inv_input: fprintf(stderr, "%s: invalid hex file input\n", filename); fclose(inf); return(-1); } c2 = getc(inf); if (!isxdigit(c2)) goto inv_input; if (count >= maxlen) { fprintf(stderr, "%s: hex input data is too long\n", filename); fclose(inf); return(-1); } databuf[count++] = (decode_hex_digit(c) << 4) | decode_hex_digit(c2); } fclose(inf); if (!count) { fprintf(stderr, "%s: no hex data input found\n", filename); return(-1); } return(count); }