FreeCalypso > hg > fc-sim-tools
annotate uicc/writecmd.c @ 91:abef3d5668b9
fc-uicc-tool: restore-file ported over from fc-simtool
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 11 Apr 2021 04:44:34 +0000 |
parents | de23872796cb |
children |
rev | line source |
---|---|
15
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 #include <sys/types.h> |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 #include <stdio.h> |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 #include <stdlib.h> |
85
c179deb9bb39
uicc/writecmd.c: forgot to update #include header set
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
4 #include <string.h> |
c179deb9bb39
uicc/writecmd.c: forgot to update #include header set
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
5 #include <strings.h> |
15
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 extern unsigned last_sel_file_record_len; |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 cmd_update_bin(argc, argv) |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 char **argv; |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 { |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 unsigned offset, len; |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 u_char data[255]; |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 int rc; |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 offset = strtoul(argv[1], 0, 0); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 if (offset > 0x7FFF) { |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 fprintf(stderr, "error: offset argument is out of range\n"); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 return(-1); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 } |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 rc = read_hex_data_file(argv[2], data, 255); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 if (rc < 0) |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 return(rc); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 len = rc; |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 return update_bin_op(offset, data, len); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 } |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 cmd_update_bin_imm(argc, argv) |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 char **argv; |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 { |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 unsigned offset, len; |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 u_char data[255]; |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 int rc; |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 offset = strtoul(argv[1], 0, 0); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 if (offset > 0x7FFF) { |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 fprintf(stderr, "error: offset argument is out of range\n"); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 return(-1); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 } |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 rc = decode_hex_data_from_string(argv[2], data, 1, 255); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 if (rc < 0) |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 return(rc); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 len = rc; |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 return update_bin_op(offset, data, len); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 } |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 cmd_update_rec(argc, argv) |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 char **argv; |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 { |
84
0c19ec7af526
fc-uicc-tool update-rec: support prev mode like fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
50 unsigned recno, mode; |
15
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 u_char data[255]; |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 int rc; |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 if (!last_sel_file_record_len) { |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 fprintf(stderr, "error: no record-based file selected\n"); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 return(-1); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 } |
84
0c19ec7af526
fc-uicc-tool update-rec: support prev mode like fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
58 if (!strcmp(argv[1], "prev")) { |
0c19ec7af526
fc-uicc-tool update-rec: support prev mode like fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
59 recno = 0; |
0c19ec7af526
fc-uicc-tool update-rec: support prev mode like fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
60 mode = 0x03; |
0c19ec7af526
fc-uicc-tool update-rec: support prev mode like fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
61 } else { |
0c19ec7af526
fc-uicc-tool update-rec: support prev mode like fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
62 recno = strtoul(argv[1], 0, 0); |
0c19ec7af526
fc-uicc-tool update-rec: support prev mode like fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
63 if (recno < 1 || recno > 255) { |
0c19ec7af526
fc-uicc-tool update-rec: support prev mode like fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
64 fprintf(stderr, |
15
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 "error: record number argument is out of range\n"); |
84
0c19ec7af526
fc-uicc-tool update-rec: support prev mode like fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
66 return(-1); |
0c19ec7af526
fc-uicc-tool update-rec: support prev mode like fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
67 } |
0c19ec7af526
fc-uicc-tool update-rec: support prev mode like fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
68 mode = 0x04; |
15
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 } |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 rc = read_hex_data_file(argv[2], data, 255); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 if (rc < 0) |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 return(rc); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 if (rc != last_sel_file_record_len) { |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 fprintf(stderr, "error: hex data length != EF record length\n"); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 return(-1); |
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 } |
84
0c19ec7af526
fc-uicc-tool update-rec: support prev mode like fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
15
diff
changeset
|
77 return update_rec_op(recno, mode, data, last_sel_file_record_len); |
15
b70d35f5476f
fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 } |
86
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
79 |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
80 cmd_update_rec_imm(argc, argv) |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
81 char **argv; |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
82 { |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
83 unsigned recno, mode; |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
84 u_char data[255]; |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
85 int rc; |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
86 |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
87 if (!last_sel_file_record_len) { |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
88 fprintf(stderr, "error: no record-based file selected\n"); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
89 return(-1); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
90 } |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
91 if (!strcmp(argv[1], "prev")) { |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
92 recno = 0; |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
93 mode = 0x03; |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
94 } else { |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
95 recno = strtoul(argv[1], 0, 0); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
96 if (recno < 1 || recno > 255) { |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
97 fprintf(stderr, |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
98 "error: record number argument is out of range\n"); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
99 return(-1); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
100 } |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
101 mode = 0x04; |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
102 } |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
103 rc = decode_hex_data_from_string(argv[2], data, 1, 255); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
104 if (rc < 0) |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
105 return(rc); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
106 if (rc != last_sel_file_record_len) { |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
107 fprintf(stderr, "error: hex data length != EF record length\n"); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
108 return(-1); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
109 } |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
110 return update_rec_op(recno, mode, data, last_sel_file_record_len); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
111 } |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
112 |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
113 cmd_update_rec_fill(argc, argv) |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
114 char **argv; |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
115 { |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
116 unsigned recno, mode, fill_byte; |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
117 u_char data[255]; |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
118 |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
119 if (!last_sel_file_record_len) { |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
120 fprintf(stderr, "error: no record-based file selected\n"); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
121 return(-1); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
122 } |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
123 if (!strcmp(argv[1], "prev")) { |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
124 recno = 0; |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
125 mode = 0x03; |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
126 } else { |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
127 recno = strtoul(argv[1], 0, 0); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
128 if (recno < 1 || recno > 255) { |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
129 fprintf(stderr, |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
130 "error: record number argument is out of range\n"); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
131 return(-1); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
132 } |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
133 mode = 0x04; |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
134 } |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
135 fill_byte = strtoul(argv[2], 0, 16); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
136 if (fill_byte > 0xFF) { |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
137 fprintf(stderr, "error: invalid fill byte argument\n"); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
138 return(-1); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
139 } |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
140 memset(data, fill_byte, last_sel_file_record_len); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
141 return update_rec_op(recno, mode, data, last_sel_file_record_len); |
de23872796cb
fc-uicc-tool: update-rec-imm and update-rec-fill ported over from fc-simtool
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
142 } |