# HG changeset patch # User Mychaela Falconia # Date 1613248124 0 # Node ID 10030acba82f3ce4e8da104c1b0231e2015f34c8 # Parent d4b5a6e547ca3d5c28ebff71c99cd2a1a5ab5db9 fc-simtool *-erase-range commands: allow "end" keyword for the last record to be erased diff -r d4b5a6e547ca -r 10030acba82f simtool/pberase.c --- a/simtool/pberase.c Sat Feb 13 19:45:04 2021 +0000 +++ b/simtool/pberase.c Sat Feb 13 20:28:44 2021 +0000 @@ -64,15 +64,20 @@ "error: specified starting record number is invalid\n"); return(-1); } - endrec = strtoul(argv[3], 0, 0); - if (endrec < 1 || endrec > curfile_record_count) { - fprintf(stderr, + if (!strcmp(argv[3], "end")) + endrec = curfile_record_count; + else { + 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); + return(-1); + } + if (startrec > endrec) { + fprintf(stderr, + "error: reverse record range specified\n"); + return(-1); + } } memset(record, 0xFF, curfile_record_len); for (recno = startrec; recno <= endrec; recno++) { diff -r d4b5a6e547ca -r 10030acba82f simtool/smserase.c --- a/simtool/smserase.c Sat Feb 13 19:45:04 2021 +0000 +++ b/simtool/smserase.c Sat Feb 13 20:28:44 2021 +0000 @@ -95,15 +95,20 @@ "error: specified starting record number is invalid\n"); return(-1); } - endrec = strtoul(argv[2], 0, 0); - if (endrec < 1 || endrec > curfile_record_count) { - fprintf(stderr, + if (!strcmp(argv[2], "end")) + endrec = curfile_record_count; + else { + endrec = strtoul(argv[2], 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); + return(-1); + } + if (startrec > endrec) { + fprintf(stderr, + "error: reverse record range specified\n"); + return(-1); + } } memset(record, 0xFF, SMS_RECORD_LEN); record[0] = 0; diff -r d4b5a6e547ca -r 10030acba82f simtool/smsp_erase.c --- a/simtool/smsp_erase.c Sat Feb 13 19:45:04 2021 +0000 +++ b/simtool/smsp_erase.c Sat Feb 13 20:28:44 2021 +0000 @@ -63,15 +63,20 @@ "error: specified starting record number is invalid\n"); return(-1); } - endrec = strtoul(argv[2], 0, 0); - if (endrec < 1 || endrec > curfile_record_count) { - fprintf(stderr, + if (!strcmp(argv[2], "end")) + endrec = curfile_record_count; + else { + endrec = strtoul(argv[2], 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); + return(-1); + } + if (startrec > endrec) { + fprintf(stderr, + "error: reverse record range specified\n"); + return(-1); + } } memset(record, 0xFF, curfile_record_len); for (recno = startrec; recno <= endrec; recno++) {