FreeCalypso > hg > fc-sim-tools
view libcommon/hexdump.c @ 57:bccf028921bb
apdu-checksw command added to both fc-simtool and fc-uicc-tool
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 22 Mar 2021 23:58:11 +0000 |
parents | c9ef9e91dd8e |
children |
line wrap: on
line source
#include <sys/types.h> #include <stdio.h> #include "simresp.h" display_sim_resp_in_hex(outf) FILE *outf; { unsigned off, cc, n, c; for (off = 0; off < sim_resp_data_len; off += cc) { fprintf(outf, "%02X:", off); cc = 16; if (sim_resp_data_len - off < cc) cc = sim_resp_data_len - off; for (n = 0; n < 16; n++) { if (n == 0 || n == 8) putc(' ', outf); putc(' ', outf); if (n < cc) fprintf(outf, "%02X", sim_resp_data[off + n]); else { putc(' ', outf); putc(' ', outf); } } putc(' ', outf); putc(' ', outf); for (n = 0; n < cc; n++) { c = sim_resp_data[off + n]; if (c < 0x20 || c > 0x7E) c = '.'; putc(c, outf); } putc('\n', outf); } return(0); } cmd_sim_resp(argc, argv, outf) char **argv; FILE *outf; { return display_sim_resp_in_hex(outf); }