annotate simtool/hlread.c @ 228:a93de68711b8

original README is now README.old
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 14 Mar 2021 18:16:27 +0000
parents 43b57865fdb5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module implements some high-level or user-friendly read commands.
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <sys/types.h>
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdio.h>
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include "simresp.h"
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include "curfile.h"
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include "file_id.h"
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10
110
2aa92dfcb4b5 fc-simtool iccid, imsi, spn: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
11 cmd_iccid(argc, argv, outf)
2aa92dfcb4b5 fc-simtool iccid, imsi, spn: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
12 char **argv;
2aa92dfcb4b5 fc-simtool iccid, imsi, spn: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
13 FILE *outf;
1
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 {
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 int rc;
55
4c570522de5d fc-simtool iccid command: strip padding F digits from display
Mychaela Falconia <falcon@freecalypso.org>
parents: 7
diff changeset
16 char buf[21], *cp;
1
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 rc = select_op(FILEID_MF);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 if (rc < 0)
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 return(rc);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 rc = select_op(EF_ICCID);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 if (rc < 0)
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 return(rc);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 rc = parse_ef_select_response();
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 if (rc < 0)
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 return(rc);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 if (curfile_structure != 0x00 || curfile_total_size != 10) {
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 fprintf(stderr, "error: expected transparent EF of 10 bytes\n");
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 return(-1);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 }
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 rc = readbin_op(0, 10);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 if (rc < 0)
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 return(rc);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 decode_reversed_nibbles(sim_resp_data, 10, buf);
55
4c570522de5d fc-simtool iccid command: strip padding F digits from display
Mychaela Falconia <falcon@freecalypso.org>
parents: 7
diff changeset
35 for (cp = buf + 20; (cp > buf + 1) && (cp[-1] == 'F'); cp--)
4c570522de5d fc-simtool iccid command: strip padding F digits from display
Mychaela Falconia <falcon@freecalypso.org>
parents: 7
diff changeset
36 ;
4c570522de5d fc-simtool iccid command: strip padding F digits from display
Mychaela Falconia <falcon@freecalypso.org>
parents: 7
diff changeset
37 *cp = '\0';
110
2aa92dfcb4b5 fc-simtool iccid, imsi, spn: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
38 fprintf(outf, "%s\n", buf);
1
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 return(0);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 }
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41
110
2aa92dfcb4b5 fc-simtool iccid, imsi, spn: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
42 cmd_imsi(argc, argv, outf)
2aa92dfcb4b5 fc-simtool iccid, imsi, spn: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
43 char **argv;
2aa92dfcb4b5 fc-simtool iccid, imsi, spn: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
44 FILE *outf;
1
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 {
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 int rc;
184
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
47 char buf[17], *endp;
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
48
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
49 rc = select_op(DF_GSM);
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
50 if (rc < 0)
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
51 return(rc);
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
52 rc = select_op(EF_IMSI);
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
53 if (rc < 0)
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
54 return(rc);
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
55 rc = parse_ef_select_response();
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
56 if (rc < 0)
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
57 return(rc);
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
58 if (curfile_structure != 0x00 || curfile_total_size != 9) {
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
59 fprintf(stderr, "error: expected transparent EF of 9 bytes\n");
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
60 return(-1);
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
61 }
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
62 rc = readbin_op(0, 9);
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
63 if (rc < 0)
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
64 return(rc);
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
65 if (sim_resp_data[0] < 1 || sim_resp_data[0] > 8) {
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
66 malformed: fprintf(stderr, "error: malformed EF_IMSI record\n");
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
67 return(-1);
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
68 }
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
69 decode_reversed_nibbles(sim_resp_data + 1, sim_resp_data[0], buf);
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
70 endp = buf + (sim_resp_data[0] << 1);
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
71 switch (buf[0]) {
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
72 case '1':
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
73 if (sim_resp_data[0] == 1)
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
74 goto malformed;
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
75 *--endp = '\0';
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
76 break;
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
77 case '9':
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
78 *endp = '\0';
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
79 break;
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
80 default:
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
81 goto malformed;
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
82 }
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
83 fprintf(outf, "%s\n", buf + 1);
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
84 return(0);
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
85 }
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
86
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
87 cmd_imsi_raw(argc, argv, outf)
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
88 char **argv;
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
89 FILE *outf;
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
90 {
8d073ff62c48 fc-simtool: imsi command does higher-level parsing,
Mychaela Falconia <falcon@freecalypso.org>
parents: 110
diff changeset
91 int rc;
1
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 char buf[17];
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 rc = select_op(DF_GSM);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 if (rc < 0)
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 return(rc);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 rc = select_op(EF_IMSI);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 if (rc < 0)
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 return(rc);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 rc = parse_ef_select_response();
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 if (rc < 0)
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 return(rc);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 if (curfile_structure != 0x00 || curfile_total_size != 9) {
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 fprintf(stderr, "error: expected transparent EF of 9 bytes\n");
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 return(-1);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 }
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 rc = readbin_op(0, 9);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 if (rc < 0)
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 return(rc);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 decode_reversed_nibbles(sim_resp_data + 1, 8, buf);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 buf[16] = '\0';
110
2aa92dfcb4b5 fc-simtool iccid, imsi, spn: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
112 fprintf(outf, "%s parity=%c len=%u\n", buf + 1, buf[0],
2aa92dfcb4b5 fc-simtool iccid, imsi, spn: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
113 sim_resp_data[0]);
1
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 return(0);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 }
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116
110
2aa92dfcb4b5 fc-simtool iccid, imsi, spn: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
117 cmd_spn(argc, argv, outf)
2aa92dfcb4b5 fc-simtool iccid, imsi, spn: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
118 char **argv;
2aa92dfcb4b5 fc-simtool iccid, imsi, spn: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
119 FILE *outf;
1
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 {
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 int rc;
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 unsigned textlen;
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 rc = select_op(DF_GSM);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 if (rc < 0)
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 return(rc);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 rc = select_op(EF_SPN);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 if (rc < 0)
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 return(rc);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 rc = parse_ef_select_response();
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 if (rc < 0)
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 return(rc);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 if (curfile_structure != 0x00 || curfile_total_size != 17) {
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 fprintf(stderr, "error: expected transparent EF of 17 bytes\n");
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 return(-1);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 }
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 rc = readbin_op(0, 17);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 if (rc < 0)
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 return(rc);
110
2aa92dfcb4b5 fc-simtool iccid, imsi, spn: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
140 fprintf(outf, "Display condition: %02X\n", sim_resp_data[0]);
2aa92dfcb4b5 fc-simtool iccid, imsi, spn: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
141 fputs("SPN: ", outf);
1
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 rc = validate_alpha_field(sim_resp_data + 1, 16, &textlen);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 if (rc >= 0)
212
43b57865fdb5 fc-simtool spn command: fix ancient bug
Mychaela Falconia <falcon@freecalypso.org>
parents: 184
diff changeset
144 print_alpha_field(sim_resp_data + 1, textlen, outf);
1
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 else
110
2aa92dfcb4b5 fc-simtool iccid, imsi, spn: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
146 fputs("malformed alpha field", outf);
2aa92dfcb4b5 fc-simtool iccid, imsi, spn: support output redirection
Mychaela Falconia <falcon@freecalypso.org>
parents: 55
diff changeset
147 putc('\n', outf);
1
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 return(0);
2071b28cd0c7 simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 }