FreeCalypso > hg > fc-pcsc-tools
comparison simtool/hlread.c @ 55:4c570522de5d
fc-simtool iccid command: strip padding F digits from display
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 13 Feb 2021 19:42:14 +0000 |
parents | 4360a7906f34 |
children | 2aa92dfcb4b5 |
comparison
equal
deleted
inserted
replaced
54:2d1679c7975b | 55:4c570522de5d |
---|---|
9 #include "file_id.h" | 9 #include "file_id.h" |
10 | 10 |
11 cmd_iccid() | 11 cmd_iccid() |
12 { | 12 { |
13 int rc; | 13 int rc; |
14 char buf[21]; | 14 char buf[21], *cp; |
15 | 15 |
16 rc = select_op(FILEID_MF); | 16 rc = select_op(FILEID_MF); |
17 if (rc < 0) | 17 if (rc < 0) |
18 return(rc); | 18 return(rc); |
19 rc = select_op(EF_ICCID); | 19 rc = select_op(EF_ICCID); |
28 } | 28 } |
29 rc = readbin_op(0, 10); | 29 rc = readbin_op(0, 10); |
30 if (rc < 0) | 30 if (rc < 0) |
31 return(rc); | 31 return(rc); |
32 decode_reversed_nibbles(sim_resp_data, 10, buf); | 32 decode_reversed_nibbles(sim_resp_data, 10, buf); |
33 buf[20] = '\0'; | 33 for (cp = buf + 20; (cp > buf + 1) && (cp[-1] == 'F'); cp--) |
34 ; | |
35 *cp = '\0'; | |
34 printf("%s\n", buf); | 36 printf("%s\n", buf); |
35 return(0); | 37 return(0); |
36 } | 38 } |
37 | 39 |
38 cmd_imsi() | 40 cmd_imsi() |