FreeCalypso > hg > fc-pcsc-tools
diff uicc/readcmd.c @ 107:f1836c8d36cb
hexdump output commands reworked to support redirection
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 19 Feb 2021 06:43:01 +0000 |
parents | 1b1468869ccf |
children | ba8c35ecf796 |
line wrap: on
line diff
--- a/uicc/readcmd.c Fri Feb 19 06:24:06 2021 +0000 +++ b/uicc/readcmd.c Fri Feb 19 06:43:01 2021 +0000 @@ -6,8 +6,9 @@ extern unsigned last_sel_file_record_len; -cmd_readbin(argc, argv) +cmd_readbin(argc, argv, outf) char **argv; + FILE *outf; { unsigned offset, len; int rc; @@ -25,12 +26,13 @@ rc = readbin_op(offset, len); if (rc < 0) return(rc); - display_sim_resp_in_hex(); + display_sim_resp_in_hex(outf); return(0); } -cmd_readrec(argc, argv) +cmd_readrec(argc, argv, outf) char **argv; + FILE *outf; { unsigned recno, len; int rc; @@ -59,12 +61,13 @@ rc = readrec_op(recno, 0x04, len); if (rc < 0) return(rc); - display_sim_resp_in_hex(); + display_sim_resp_in_hex(outf); return(0); } -cmd_readef(argc, argv) +cmd_readef(argc, argv, outf) char **argv; + FILE *outf; { int file_id, rc; unsigned file_len, readlen; @@ -85,7 +88,8 @@ rc = select_resp_get_transparent(&file_len); if (rc < 0) return(rc); - printf("Transparent EF of %u byte(s)\n", file_len); + if (outf == stdout) + printf("Transparent EF of %u byte(s)\n", file_len); if (!file_len) return(0); readlen = file_len; @@ -94,6 +98,6 @@ rc = readbin_op(0, readlen); if (rc < 0) return(rc); - display_sim_resp_in_hex(); + display_sim_resp_in_hex(outf); return(0); }