FreeCalypso > hg > fc-pcsc-tools
annotate simtool/lndwrite.c @ 83:07e395fddfe1
lnd-write command implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 17 Feb 2021 06:08:28 +0000 |
parents | simtool/pbupd_imm.c@52ec2d3eb851 |
children | 51f26fd967e2 |
rev | line source |
---|---|
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
83
07e395fddfe1
lnd-write command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
2 * This module implements lnd-write and lnd-erase commands. |
1
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 <string.h> |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <strings.h> |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdio.h> |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdlib.h> |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include "curfile.h" |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
83
07e395fddfe1
lnd-write command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
12 cmd_lnd_write(argc, argv) |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 char **argv; |
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; |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 u_char record[255], *fixp; |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
83
07e395fddfe1
lnd-write command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
18 rc = select_ef_lnd(); |
1
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 memset(record, 0xFF, curfile_record_len); |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 fixp = record + curfile_record_len - 14; |
83
07e395fddfe1
lnd-write command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
23 rc = encode_phone_number_arg(argv[1], fixp, 0); |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 if (rc < 0) |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 return(rc); |
83
07e395fddfe1
lnd-write command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
26 if (argv[2]) { |
07e395fddfe1
lnd-write command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
27 rc = qstring_arg_to_gsm7(argv[2], record, |
10
a76ec3e7da09
simtool/pbupdate.c: a little refactoring from fc-uicc-tool
Mychaela Falconia <falcon@freecalypso.org>
parents:
1
diff
changeset
|
28 curfile_record_len - 14); |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 if (rc < 0) |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 return(rc); |
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 } |
83
07e395fddfe1
lnd-write command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
43
diff
changeset
|
32 return update_rec_op(0, 0x03, record, curfile_record_len); |
1
2071b28cd0c7
simtool: first refactored version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 } |