FreeCalypso > hg > fc-pcsc-tools
annotate simtool/smsp_set.c @ 150:0d007555ac89
libcommon/file_id.h: add FILEID_ADF
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 25 Feb 2021 16:55:22 +0000 |
parents | 5bca197e7495 |
children |
rev | line source |
---|---|
44
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module implements the user-oriented smsp-set and smsp-set-tag commands. |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <sys/types.h> |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <ctype.h> |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <string.h> |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <strings.h> |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <stdio.h> |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <stdlib.h> |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include "curfile.h" |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 static |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 set_param_da(arg, fixp) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 char *arg; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 u_char *fixp; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 { |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 int rc; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 rc = encode_phone_number_arg(arg, fixp + 1, 1); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 if (rc < 0) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 return(rc); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 fixp[0] &= 0xFE; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 return(0); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 } |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 static |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 set_param_sc(arg, fixp) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 char *arg; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 u_char *fixp; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 { |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 int rc; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 rc = encode_phone_number_arg(arg, fixp + 13, 0); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 if (rc < 0) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 return(rc); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 fixp[0] &= 0xFD; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 return(0); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 } |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 static |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 set_param_pid(arg, fixp) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 char *arg; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 u_char *fixp; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 { |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 char *endp; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 if (!isdigit(*arg)) { |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 inv: fprintf(stderr, "error: invalid PID= parameter\n"); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 return(-1); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 } |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 fixp[25] = strtoul(arg, &endp, 0); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 if (*endp) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 goto inv; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 fixp[0] &= 0xFB; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 return(0); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 } |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 static |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 set_param_dcs(arg, fixp) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 char *arg; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 u_char *fixp; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 { |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 char *endp; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 if (!isdigit(*arg)) { |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 inv: fprintf(stderr, "error: invalid DCS= parameter\n"); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 return(-1); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 } |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 fixp[26] = strtoul(arg, &endp, 0); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 if (*endp) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 goto inv; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 fixp[0] &= 0xF7; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 return(0); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 } |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 static |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 set_param_vp(arg, fixp) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 char *arg; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 u_char *fixp; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 { |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 char *endp; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 if (!isdigit(*arg)) { |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 inv: fprintf(stderr, "error: invalid VP= parameter\n"); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 return(-1); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 } |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 fixp[27] = strtoul(arg, &endp, 0); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 if (*endp) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 goto inv; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 fixp[0] &= 0xEF; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 return(0); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 } |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 static |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 set_param(arg, fixp) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 char *arg; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 u_char *fixp; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 { |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 if (!strncasecmp(arg, "DA=", 3)) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 return set_param_da(arg + 3, fixp); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 if (!strncasecmp(arg, "SC=", 3)) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 return set_param_sc(arg + 3, fixp); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 if (!strncasecmp(arg, "PID=", 4)) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 return set_param_pid(arg + 4, fixp); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 if (!strncasecmp(arg, "DCS=", 4)) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 return set_param_dcs(arg + 4, fixp); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 if (!strncasecmp(arg, "VP=", 3)) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 return set_param_vp(arg + 3, fixp); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 fprintf(stderr, "error: non-understood parameter \"%s\"\n", arg); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 return(-1); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 } |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 cmd_smsp_set(argc, argv) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 char **argv; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 { |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 int rc; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 unsigned recno; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 u_char record[255], *fixp; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 char **ap; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 rc = select_ef_smsp(); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 if (rc < 0) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 return(rc); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 recno = strtoul(argv[1], 0, 0); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 if (recno < 1 || recno > curfile_record_count) { |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 fprintf(stderr, "error: specified record number is invalid\n"); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 return(-1); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 } |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 memset(record, 0xFF, curfile_record_len); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 fixp = record + curfile_record_len - 28; |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 for (ap = argv + 2; *ap; ap++) { |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 rc = set_param(*ap, fixp); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 if (rc < 0) |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 return(rc); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 } |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 return update_rec_op(recno, 0x04, record, curfile_record_len); |
f4eb1e83b4b3
fc-simtool smsp-set command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 } |
45
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
139 |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
140 cmd_smsp_set_tag(argc, argv) |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
141 char **argv; |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
142 { |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
143 int rc; |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
144 unsigned recno; |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
145 u_char record[255], *fixp; |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
146 char **ap; |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
147 |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
148 rc = select_ef_smsp(); |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
149 if (rc < 0) |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
150 return(rc); |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
151 recno = strtoul(argv[1], 0, 0); |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
152 if (recno < 1 || recno > curfile_record_count) { |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
153 fprintf(stderr, "error: specified record number is invalid\n"); |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
154 return(-1); |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
155 } |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
156 memset(record, 0xFF, curfile_record_len); |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
157 rc = qstring_arg_to_gsm7(argv[2], record, curfile_record_len - 28); |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
158 if (rc < 0) |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
159 return(rc); |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
160 fixp = record + curfile_record_len - 28; |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
161 for (ap = argv + 3; *ap; ap++) { |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
162 rc = set_param(*ap, fixp); |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
163 if (rc < 0) |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
164 return(rc); |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
165 } |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
166 return update_rec_op(recno, 0x04, record, curfile_record_len); |
5bca197e7495
fc-simtool smsp-set-tag command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
44
diff
changeset
|
167 } |