FreeCalypso > hg > fc-pcsc-tools
view simtool/opldump.c @ 54:2d1679c7975b
fc-simtool opl-dump implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 13 Feb 2021 06:44:34 +0000 |
parents | |
children | 440a4582d2a5 |
line wrap: on
line source
/* * This module implements the opl-dump command, * a companion command to pnn-dump. */ #include <sys/types.h> #include <stdio.h> #include "simresp.h" #include "curfile.h" #include "file_id.h" static void dump_record(recno) unsigned recno; { char ascbuf[8]; decode_plmn_3bytes(sim_resp_data, ascbuf, 0); printf("#%u: %s %02X%02X-%02X%02X %u\n", recno, ascbuf, sim_resp_data[3], sim_resp_data[4], sim_resp_data[5], sim_resp_data[6], sim_resp_data[7]); } cmd_opl_dump() { int rc; unsigned recno; rc = select_op(DF_GSM); if (rc < 0) return(rc); rc = select_op(EF_OPL); if (rc < 0) return(rc); rc = parse_ef_select_response(); if (rc < 0) return(rc); if (curfile_structure != 0x01) { fprintf(stderr, "error: EF_OPL is not linear fixed\n"); return(-1); } if (curfile_record_len < 8) { fprintf(stderr, "error: EF_OPL record length is less than the spec minimum of 8 bytes\n"); return(-1); } for (recno = 1; recno <= curfile_record_count; recno++) { rc = readrec_op(recno, 0x04, curfile_record_len); if (rc < 0) return(rc); if (check_simresp_all_blank()) continue; dump_record(recno); } return(0); }