FreeCalypso > hg > fc-pcsc-tools
view libcommon/hexdump.c @ 208:ead7e546ad75
scripts/fcsim1-sst created
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 07 Mar 2021 05:39:23 +0000 |
parents | f1836c8d36cb |
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); }