FreeCalypso > hg > fc-pcsc-tools
changeset 82:fe660c7ea97f
lnd-dump command can save to file like pb-dump and smsp-dump
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 17 Feb 2021 05:59:27 +0000 |
parents | e89004a245ce |
children | 07e395fddfe1 |
files | simtool/dispatch.c simtool/pbdump.c |
diffstat | 2 files changed, 19 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/simtool/dispatch.c Wed Feb 17 05:53:22 2021 +0000 +++ b/simtool/dispatch.c Wed Feb 17 05:59:27 2021 +0000 @@ -112,7 +112,7 @@ {"grcard2-set-super-hex", 1, 1, cmd_grcard2_set_super_hex}, {"iccid", 0, 0, cmd_iccid}, {"imsi", 0, 0, cmd_imsi}, - {"lnd-dump", 0, 0, cmd_lnd_dump}, + {"lnd-dump", 0, 1, cmd_lnd_dump}, {"opl-dump", 0, 0, cmd_opl_dump}, {"pb-dump", 1, 2, cmd_pb_dump}, {"pb-dump-rec", 2, 3, cmd_pb_dump_rec},
--- a/simtool/pbdump.c Wed Feb 17 05:53:22 2021 +0000 +++ b/simtool/pbdump.c Wed Feb 17 05:59:27 2021 +0000 @@ -132,21 +132,36 @@ return(0); } -cmd_lnd_dump() +cmd_lnd_dump(argc, argv) + char **argv; { int rc; + FILE *outf; unsigned recno; rc = select_ef_lnd(); if (rc < 0) return(rc); + if (argv[1]) { + outf = fopen(argv[1], "w"); + if (!outf) { + perror(argv[1]); + return(-1); + } + } else + outf = stdout; for (recno = 1; recno <= curfile_record_count; recno++) { rc = readrec_op(recno, 0x04, curfile_record_len); - if (rc < 0) + if (rc < 0) { + if (argv[1]) + fclose(outf); return(rc); + } if (check_simresp_all_blank()) continue; - dump_record(recno, stdout); + dump_record(recno, outf); } + if (argv[1]) + fclose(outf); return(0); }