FreeCalypso > hg > fc-sim-tools
comparison simtool/hlread.c @ 29:aefc9fe653d3
fc-simtool: iccid reading refactored
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 17 Mar 2021 00:00:15 +0000 |
parents | ddd767f6e15b |
children |
comparison
equal
deleted
inserted
replaced
28:fa81221ac9b6 | 29:aefc9fe653d3 |
---|---|
6 #include <stdio.h> | 6 #include <stdio.h> |
7 #include "simresp.h" | 7 #include "simresp.h" |
8 #include "curfile.h" | 8 #include "curfile.h" |
9 #include "file_id.h" | 9 #include "file_id.h" |
10 | 10 |
11 cmd_iccid(argc, argv, outf) | 11 retrieve_iccid(buf) |
12 char **argv; | 12 char *buf; |
13 FILE *outf; | |
14 { | 13 { |
15 int rc; | 14 int rc; |
16 char buf[21], *cp; | 15 char *cp; |
17 | 16 |
18 rc = select_op(FILEID_MF); | 17 rc = select_op(FILEID_MF); |
19 if (rc < 0) | 18 if (rc < 0) |
20 return(rc); | 19 return(rc); |
21 rc = select_op(EF_ICCID); | 20 rc = select_op(EF_ICCID); |
33 return(rc); | 32 return(rc); |
34 decode_reversed_nibbles(sim_resp_data, 10, buf); | 33 decode_reversed_nibbles(sim_resp_data, 10, buf); |
35 for (cp = buf + 20; (cp > buf + 1) && (cp[-1] == 'F'); cp--) | 34 for (cp = buf + 20; (cp > buf + 1) && (cp[-1] == 'F'); cp--) |
36 ; | 35 ; |
37 *cp = '\0'; | 36 *cp = '\0'; |
37 return(0); | |
38 } | |
39 | |
40 cmd_iccid(argc, argv, outf) | |
41 char **argv; | |
42 FILE *outf; | |
43 { | |
44 int rc; | |
45 char buf[21]; | |
46 | |
47 rc = retrieve_iccid(buf); | |
48 if (rc < 0) | |
49 return(rc); | |
38 fprintf(outf, "%s\n", buf); | 50 fprintf(outf, "%s\n", buf); |
39 return(0); | 51 return(0); |
40 } | 52 } |
41 | 53 |
42 cmd_imsi(argc, argv, outf) | 54 cmd_imsi(argc, argv, outf) |