# HG changeset patch # User Mychaela Falconia # Date 1611810730 0 # Node ID f18704e91393d9f65b71bf8bf5ceaa6e15079579 # Parent 87b34a24490156c289f6ea80e49ae5caafd6f9de fc-simtool: pb-dump-rec command implemented diff -r 87b34a244901 -r f18704e91393 simtool/dispatch.c --- a/simtool/dispatch.c Thu Jan 28 05:04:16 2021 +0000 +++ b/simtool/dispatch.c Thu Jan 28 05:12:10 2021 +0000 @@ -19,6 +19,7 @@ extern int cmd_iccid(); extern int cmd_imsi(); extern int cmd_pb_dump(); +extern int cmd_pb_dump_rec(); extern int cmd_pb_erase(); extern int cmd_pb_erase_one(); extern int cmd_pb_erase_range(); @@ -68,6 +69,7 @@ {"iccid", 0, 0, cmd_iccid}, {"imsi", 0, 0, cmd_imsi}, {"pb-dump", 1, 2, cmd_pb_dump}, + {"pb-dump-rec", 2, 3, cmd_pb_dump_rec}, {"pb-erase", 1, 1, cmd_pb_erase}, {"pb-erase-one", 2, 2, cmd_pb_erase_one}, {"pb-erase-range", 3, 3, cmd_pb_erase_range}, diff -r 87b34a244901 -r f18704e91393 simtool/pbdump.c --- a/simtool/pbdump.c Thu Jan 28 05:04:16 2021 +0000 +++ b/simtool/pbdump.c Thu Jan 28 05:12:10 2021 +0000 @@ -140,3 +140,43 @@ fclose(outf); return(0); } + +cmd_pb_dump_rec(argc, argv) + char **argv; +{ + int rc; + unsigned recno, startrec, endrec; + + rc = phonebook_op_common(argv[1]); + if (rc < 0) + return(rc); + startrec = strtoul(argv[2], 0, 0); + if (startrec < 1 || startrec > curfile_record_count) { + fprintf(stderr, + "error: specified starting record number is invalid\n"); + return(-1); + } + if (argv[3]) { + endrec = strtoul(argv[3], 0, 0); + if (endrec < 1 || endrec > curfile_record_count) { + fprintf(stderr, + "error: specified final record number is invalid\n"); + return(-1); + } + if (startrec > endrec) { + fprintf(stderr, + "error: reverse record range specified\n"); + return(-1); + } + } else + endrec = startrec; + for (recno = startrec; recno <= endrec; recno++) { + rc = readrec_op(recno, 0x04, curfile_record_len); + if (rc < 0) + return(rc); + if (check_all_blank()) + continue; + dump_record(recno, stdout); + } + return(0); +}