FreeCalypso > hg > fc-pcsc-tools
diff simtool/pbdump.c @ 58:1861d9fb7751
fc-simtool dump-lnd command implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 13 Feb 2021 21:40:38 +0000 |
parents | 72a24b8538eb |
children | 0b29c0d19db4 |
line wrap: on
line diff
--- a/simtool/pbdump.c Sat Feb 13 20:28:44 2021 +0000 +++ b/simtool/pbdump.c Sat Feb 13 21:40:38 2021 +0000 @@ -7,6 +7,7 @@ #include <stdlib.h> #include "simresp.h" #include "curfile.h" +#include "file_id.h" static check_blank_area(dp, endp) @@ -131,3 +132,38 @@ } return(0); } + +cmd_dump_lnd() +{ + int rc; + unsigned recno; + + rc = select_op(DF_TELECOM); + if (rc < 0) + return(rc); + rc = select_op(EF_LND); + if (rc < 0) + return(rc); + rc = parse_ef_select_response(); + if (rc < 0) + return(rc); + if (curfile_structure != 0x03) { + fprintf(stderr, "error: EF_LND is not cyclic\n"); + return(-1); + } + if (curfile_record_len < 14) { + fprintf(stderr, + "error: EF_LND has record length of %u bytes, less than minimum 14\n", + curfile_record_len); + 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, stdout); + } + return(0); +}