FreeCalypso > hg > fc-pcsc-tools
changeset 202:3f6f50103dd3
fc-simtool: update-rec-prev separate command eliminated,
absorbed into regular update-rec
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 07 Mar 2021 04:06:39 +0000 |
parents | fc1635333d81 |
children | 647267e39c21 |
files | simtool/dispatch.c simtool/writecmd.c |
diffstat | 2 files changed, 14 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/simtool/dispatch.c Sun Mar 07 03:58:49 2021 +0000 +++ b/simtool/dispatch.c Sun Mar 07 04:06:39 2021 +0000 @@ -92,7 +92,6 @@ extern int cmd_update_bin(); extern int cmd_update_bin_imm(); extern int cmd_update_rec(); -extern int cmd_update_rec_prev(); extern int cmd_user_sum(); extern int cmd_verify_chv(); extern int cmd_verify_ext(); @@ -220,7 +219,6 @@ {"update-bin", 2, 2, 0, cmd_update_bin}, {"update-bin-imm", 2, 2, 0, cmd_update_bin_imm}, {"update-rec", 2, 2, 0, cmd_update_rec}, - {"update-rec-prev", 1, 1, 0, cmd_update_rec_prev}, {"user-sum", 0, 0, 1, cmd_user_sum}, {"verify-chv1", 1, 1, 0, cmd_verify_chv}, {"verify-chv2", 1, 1, 0, cmd_verify_chv},
--- a/simtool/writecmd.c Sun Mar 07 03:58:49 2021 +0000 +++ b/simtool/writecmd.c Sun Mar 07 04:06:39 2021 +0000 @@ -1,6 +1,8 @@ #include <sys/types.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> +#include <strings.h> #include "curfile.h" cmd_update_bin(argc, argv) @@ -44,15 +46,21 @@ cmd_update_rec(argc, argv) char **argv; { - unsigned recno; + unsigned recno, mode; u_char data[255]; int rc; - recno = strtoul(argv[1], 0, 0); - if (recno < 1 || recno > 255) { - fprintf(stderr, + if (!strcmp(argv[1], "prev")) { + recno = 0; + mode = 0x03; + } else { + recno = strtoul(argv[1], 0, 0); + if (recno < 1 || recno > 255) { + fprintf(stderr, "error: record number argument is out of range\n"); - return(-1); + return(-1); + } + mode = 0x04; } rc = read_hex_data_file(argv[2], data, 255); if (rc < 0) @@ -61,21 +69,5 @@ fprintf(stderr, "error: hex data length != EF record length\n"); return(-1); } - return update_rec_op(recno, 0x04, data, curfile_record_len); + return update_rec_op(recno, mode, data, curfile_record_len); } - -cmd_update_rec_prev(argc, argv) - char **argv; -{ - u_char data[255]; - int rc; - - rc = read_hex_data_file(argv[1], data, 255); - if (rc < 0) - return(rc); - if (rc != curfile_record_len) { - fprintf(stderr, "error: hex data length != EF record length\n"); - return(-1); - } - return update_rec_op(0, 0x03, data, curfile_record_len); -}