# HG changeset patch # User Mychaela Falconia # Date 1613252438 0 # Node ID 1861d9fb775169788553a9a988927c94af96626c # Parent 10030acba82f3ce4e8da104c1b0231e2015f34c8 fc-simtool dump-lnd command implemented diff -r 10030acba82f -r 1861d9fb7751 simtool/dispatch.c --- a/simtool/dispatch.c Sat Feb 13 20:28:44 2021 +0000 +++ b/simtool/dispatch.c Sat Feb 13 21:40:38 2021 +0000 @@ -11,6 +11,7 @@ extern int cmd_a38(); extern int cmd_change_chv(); extern int cmd_disable_chv(); +extern int cmd_dump_lnd(); extern int cmd_enable_chv(); extern int cmd_exec(); extern int cmd_fix_sysmo_msisdn(); @@ -81,6 +82,7 @@ {"change-pin2", 2, 2, cmd_change_chv}, {"disable-chv", 1, 1, cmd_disable_chv}, {"disable-pin", 1, 1, cmd_disable_chv}, + {"dump-lnd", 0, 0, cmd_dump_lnd}, {"enable-chv", 1, 1, cmd_enable_chv}, {"enable-pin", 1, 1, cmd_enable_chv}, {"exec", 1, 1, cmd_exec}, diff -r 10030acba82f -r 1861d9fb7751 simtool/pbdump.c --- 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 #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); +}