FreeCalypso > hg > freecalypso-hwlab
changeset 89:fb75855a74a9
fc-simtool: select response parsing: show number of records
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 24 Jan 2021 18:03:55 +0000 |
parents | 91486a77643e |
children | 53e2c00566af |
files | simtool/globals.c simtool/globals.h simtool/select.c |
diffstat | 3 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/simtool/globals.c Sun Jan 24 05:09:48 2021 +0000 +++ b/simtool/globals.c Sun Jan 24 18:03:55 2021 +0000 @@ -7,3 +7,4 @@ char *reader_name_buf; u_char sim_resp_data[258]; unsigned sim_resp_data_len, sim_resp_sw; +unsigned curfile_record_len;
--- a/simtool/globals.h Sun Jan 24 05:09:48 2021 +0000 +++ b/simtool/globals.h Sun Jan 24 18:03:55 2021 +0000 @@ -5,3 +5,4 @@ extern char *reader_name_buf; extern u_char sim_resp_data[]; extern unsigned sim_resp_data_len, sim_resp_sw; +extern unsigned curfile_record_len;
--- a/simtool/select.c Sun Jan 24 05:09:48 2021 +0000 +++ b/simtool/select.c Sun Jan 24 18:03:55 2021 +0000 @@ -83,6 +83,7 @@ char **argv; { int file_id, rc; + unsigned file_size; if (isxdigit(argv[1][0]) && isxdigit(argv[1][1]) && isxdigit(argv[1][2]) && isxdigit(argv[1][3]) && !argv[1][4]) @@ -127,8 +128,8 @@ break; case 0x04: printf("File type: EF\n"); - printf("File size: %u\n", - (sim_resp_data[2] << 8) | sim_resp_data[3]); + file_size = (sim_resp_data[2] << 8) | sim_resp_data[3]; + printf("File size: %u\n", file_size); switch (sim_resp_data[13]) { case 0x00: printf("Structure: transparent\n"); @@ -146,6 +147,10 @@ return(-1); } printf("Record length: %u\n", sim_resp_data[14]); + curfile_record_len = sim_resp_data[14]; + if (file_size % curfile_record_len == 0) + printf("Number of records: %u\n", + file_size / curfile_record_len); break; default: printf("Structure: %02X (unknown)\n",