FreeCalypso > hg > freecalypso-hwlab
changeset 115:0dcd666292e4
fc-simtool: pb-erase-one command implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 28 Jan 2021 02:56:10 +0000 |
parents | 34c090f35515 |
children | c8685074c845 |
files | simtool/dispatch.c simtool/pberase.c |
diffstat | 2 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/simtool/dispatch.c Thu Jan 28 01:46:40 2021 +0000 +++ b/simtool/dispatch.c Thu Jan 28 02:56:10 2021 +0000 @@ -20,6 +20,7 @@ extern int cmd_imsi(); extern int cmd_pb_dump(); extern int cmd_pb_erase(); +extern int cmd_pb_erase_one(); extern int cmd_pb_update(); extern int cmd_readbin(); extern int cmd_readef(); @@ -64,6 +65,7 @@ {"imsi", 0, 0, cmd_imsi}, {"pb-dump", 1, 2, cmd_pb_dump}, {"pb-erase", 1, 1, cmd_pb_erase}, + {"pb-erase-one", 2, 2, cmd_pb_erase_one}, {"pb-update", 2, 2, cmd_pb_update}, {"quit", 0, 0, cmd_exit}, {"readbin", 2, 2, cmd_readbin},
--- a/simtool/pberase.c Thu Jan 28 01:46:40 2021 +0000 +++ b/simtool/pberase.c Thu Jan 28 02:56:10 2021 +0000 @@ -29,3 +29,22 @@ } return(0); } + +cmd_pb_erase_one(argc, argv) + char **argv; +{ + int rc; + unsigned recno; + u_char record[255]; + + rc = phonebook_op_common(argv[1]); + if (rc < 0) + return(rc); + recno = strtoul(argv[2], 0, 0); + if (recno < 1 || recno > curfile_record_count) { + fprintf(stderr, "error: specified record number is invalid\n"); + return(-1); + } + memset(record, 0xFF, curfile_record_len); + return update_rec_op(recno, 0x04, record, curfile_record_len); +}