comparison uicc/hlread.c @ 61:97646b363eaa

fc-uicc-tool: sws-lookup and sws-auth-* commands ported over
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 23 Mar 2021 06:07:06 +0000
parents b70d35f5476f
children
comparison
equal deleted inserted replaced
60:a4ffd4e44b76 61:97646b363eaa
5 #include <sys/types.h> 5 #include <sys/types.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include "simresp.h" 7 #include "simresp.h"
8 #include "file_id.h" 8 #include "file_id.h"
9 9
10 cmd_iccid(argc, argv, outf) 10 retrieve_iccid(buf)
11 char **argv; 11 char *buf;
12 FILE *outf;
13 { 12 {
14 int rc; 13 int rc;
15 unsigned len; 14 unsigned len;
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 }