FreeCalypso > hg > fc-pcsc-tools
view libcommon/hexdump.c @ 114:2c07684a3980
fc-simtool pnn-dump: support output redirection
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 19 Feb 2021 07:22:56 +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); }