comparison uicc/hexdump.c @ 130:f691a19f191d

fc-uicc-tool skeleton started
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 04 Feb 2021 00:08:12 +0000
parents
children
comparison
equal deleted inserted replaced
129:2adb802b2a98 130:f691a19f191d
1 #include <sys/types.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <pcsclite.h>
5 #include <winscard.h>
6 #include "globals.h"
7
8 display_sim_resp_in_hex()
9 {
10 unsigned off, cc, n, c;
11
12 for (off = 0; off < sim_resp_data_len; off += cc) {
13 printf("%02X:", off);
14 cc = 16;
15 if (sim_resp_data_len - off < cc)
16 cc = sim_resp_data_len - off;
17 for (n = 0; n < 16; n++) {
18 if (n == 0 || n == 8)
19 putchar(' ');
20 putchar(' ');
21 if (n < cc)
22 printf("%02X", sim_resp_data[off + n]);
23 else {
24 putchar(' ');
25 putchar(' ');
26 }
27 }
28 putchar(' ');
29 putchar(' ');
30 for (n = 0; n < cc; n++) {
31 c = sim_resp_data[off + n];
32 if (c < 0x20 || c > 0x7E)
33 c = '.';
34 putchar(c);
35 }
36 putchar('\n');
37 }
38 return(0);
39 }