# HG changeset patch # User Mychaela Falconia # Date 1613267105 0 # Node ID 090704d1ddc17ff3b251d1c5848ea6ba673c6173 # Parent c56e63a8725d7eaeb6fd8dfa9dfa4ebece4c1ae5 simtool: C module implementing sst command renamed from sstdump.c to sstlist.c diff -r c56e63a8725d -r 090704d1ddc1 simtool/Makefile --- a/simtool/Makefile Sun Feb 14 01:43:56 2021 +0000 +++ b/simtool/Makefile Sun Feb 14 01:45:05 2021 +0000 @@ -5,7 +5,7 @@ hlread.o main.o opldump.o pbcommon.o pbdump.o pberase.o pbupd_file.o \ pbupd_imm.o pbupd_immhex.o plmnsel.o pnndump.o readcmd.o readops.o \ restorebin.o savebin.o script.o select.o smserase.o smsp_common.o \ - smsp_dump.o smsp_erase.o smsp_restore.o smsp_set.o sstdump.o sysmo.o \ + smsp_dump.o smsp_erase.o smsp_restore.o smsp_set.o sstlist.o sysmo.o \ telsum.o writecmd.o writeops.o LIBS= ../libcommon/libcommon.a INSTBIN=/opt/freecalypso/bin diff -r c56e63a8725d -r 090704d1ddc1 simtool/sstdump.c --- a/simtool/sstdump.c Sun Feb 14 01:43:56 2021 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* - * This module implements the sst command, listing the SIM Service Table - * in a human-readable, yet very compact form: just a list of activated - * (or allocated but not activated, specially marked) service numbers. - */ - -#include -#include -#include "simresp.h" -#include "curfile.h" -#include "file_id.h" - -cmd_sst() -{ - int rc; - unsigned byte, pos, code, nserv, linelen; - - rc = select_op(DF_GSM); - if (rc < 0) - return(rc); - rc = select_op(EF_SST); - if (rc < 0) - return(rc); - rc = parse_ef_select_response(); - if (rc < 0) - return(rc); - if (curfile_structure != 0x00) { - fprintf(stderr, "error: EF_SST is not transparent\n"); - return(-1); - } - if (curfile_total_size < 2) { - fprintf(stderr, - "error: EF_SST is shorter than spec minimum of 2 bytes\n"); - return(-1); - } - if (curfile_total_size > 256) { - fprintf(stderr, - "error: EF_SST is longer than our 256 byte limit\n"); - return(-1); - } - rc = readbin_op(0, curfile_total_size); - if (rc < 0) - return(rc); - linelen = 0; - for (byte = 0, nserv = 1; byte < curfile_total_size; byte++) { - for (pos = 0; pos < 8; pos += 2, nserv++) { - code = (sim_resp_data[byte] >> pos) & 3; - if (!(code & 1)) - continue; - if (linelen > 73) { - putchar('\n'); - linelen = 0; - } - if (linelen) { - putchar(' '); - linelen++; - } - linelen += printf("%u", nserv); - if (!(code & 2)) { - putchar('^'); - linelen++; - } - } - } - if (linelen) - putchar('\n'); - return(0); -} diff -r c56e63a8725d -r 090704d1ddc1 simtool/sstlist.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/simtool/sstlist.c Sun Feb 14 01:45:05 2021 +0000 @@ -0,0 +1,68 @@ +/* + * This module implements the sst command, listing the SIM Service Table + * in a human-readable, yet very compact form: just a list of activated + * (or allocated but not activated, specially marked) service numbers. + */ + +#include +#include +#include "simresp.h" +#include "curfile.h" +#include "file_id.h" + +cmd_sst() +{ + int rc; + unsigned byte, pos, code, nserv, linelen; + + rc = select_op(DF_GSM); + if (rc < 0) + return(rc); + rc = select_op(EF_SST); + if (rc < 0) + return(rc); + rc = parse_ef_select_response(); + if (rc < 0) + return(rc); + if (curfile_structure != 0x00) { + fprintf(stderr, "error: EF_SST is not transparent\n"); + return(-1); + } + if (curfile_total_size < 2) { + fprintf(stderr, + "error: EF_SST is shorter than spec minimum of 2 bytes\n"); + return(-1); + } + if (curfile_total_size > 256) { + fprintf(stderr, + "error: EF_SST is longer than our 256 byte limit\n"); + return(-1); + } + rc = readbin_op(0, curfile_total_size); + if (rc < 0) + return(rc); + linelen = 0; + for (byte = 0, nserv = 1; byte < curfile_total_size; byte++) { + for (pos = 0; pos < 8; pos += 2, nserv++) { + code = (sim_resp_data[byte] >> pos) & 3; + if (!(code & 1)) + continue; + if (linelen > 73) { + putchar('\n'); + linelen = 0; + } + if (linelen) { + putchar(' '); + linelen++; + } + linelen += printf("%u", nserv); + if (!(code & 2)) { + putchar('^'); + linelen++; + } + } + } + if (linelen) + putchar('\n'); + return(0); +}