FreeCalypso > hg > fc-sim-tools
comparison simtool/lndwrite.c @ 10:ddd767f6e15b
fc-simtool ported over
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 14 Mar 2021 07:11:25 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
9:c9ef9e91dd8e | 10:ddd767f6e15b |
---|---|
1 /* | |
2 * This module implements lnd-write and lnd-erase commands. | |
3 */ | |
4 | |
5 #include <sys/types.h> | |
6 #include <string.h> | |
7 #include <strings.h> | |
8 #include <stdio.h> | |
9 #include <stdlib.h> | |
10 #include "curfile.h" | |
11 | |
12 cmd_lnd_write(argc, argv) | |
13 char **argv; | |
14 { | |
15 int rc; | |
16 u_char record[255], *fixp; | |
17 | |
18 rc = select_ef_lnd(); | |
19 if (rc < 0) | |
20 return(rc); | |
21 memset(record, 0xFF, curfile_record_len); | |
22 fixp = record + curfile_record_len - 14; | |
23 rc = encode_phone_number_arg(argv[1], fixp, 0); | |
24 if (rc < 0) | |
25 return(rc); | |
26 if (argv[2]) { | |
27 rc = qstring_arg_to_gsm7(argv[2], record, | |
28 curfile_record_len - 14); | |
29 if (rc < 0) | |
30 return(rc); | |
31 } | |
32 return update_rec_op(0, 0x03, record, curfile_record_len); | |
33 } | |
34 | |
35 cmd_lnd_erase(argc, argv) | |
36 char **argv; | |
37 { | |
38 int rc; | |
39 u_char record[255]; | |
40 unsigned count; | |
41 | |
42 rc = select_ef_lnd(); | |
43 if (rc < 0) | |
44 return(rc); | |
45 memset(record, 0xFF, curfile_record_len); | |
46 for (count = 0; count < curfile_record_count; count++) { | |
47 rc = update_rec_op(0, 0x03, record, curfile_record_len); | |
48 if (rc < 0) | |
49 return(rc); | |
50 } | |
51 return(0); | |
52 } |