comparison smpp-send/settings.c @ 223:f11c3e40c87a

new program smpp-send
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 05 Aug 2023 12:24:31 -0800
parents
children
comparison
equal deleted inserted replaced
222:9d6e8d99d2b1 223:f11c3e40c87a
1 /*
2 * This module implements functions for various settings that come before
3 * msg or msg-udh lines.
4 */
5
6 #include <sys/types.h>
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <string.h>
10 #include <strings.h>
11 #include "error.h"
12
13 extern char src_addr[21], dest_addr[21];
14 extern u_char src_ton, src_npi, dest_ton, dest_npi;
15 extern u_char esm_class, pid_byte, dcs_byte;
16 extern u_char prio_flag, reg_deliv, replace_flag;
17
18 extern int input_lineno;
19
20 void
21 set_src_addr(argc, argv)
22 char **argv;
23 {
24 if (strlen(argv[1]) > 20) {
25 fprintf(stderr, ERR_PREFIX
26 "phone number argument is too long\n", input_lineno);
27 exit(1);
28 }
29 strcpy(src_addr, argv[1]);
30 }
31
32 void
33 set_src_ton(argc, argv)
34 char **argv;
35 {
36 char *endp;
37
38 src_ton = strtoul(argv[1], &endp, 0);
39 if (*endp) {
40 fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
41 input_lineno);
42 exit(1);
43 }
44 }
45
46 void
47 set_src_npi(argc, argv)
48 char **argv;
49 {
50 char *endp;
51
52 src_npi = strtoul(argv[1], &endp, 0);
53 if (*endp) {
54 fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
55 input_lineno);
56 exit(1);
57 }
58 }
59
60 void
61 set_dest_addr(argc, argv)
62 char **argv;
63 {
64 if (strlen(argv[1]) > 20) {
65 fprintf(stderr, ERR_PREFIX
66 "phone number argument is too long\n", input_lineno);
67 exit(1);
68 }
69 strcpy(dest_addr, argv[1]);
70 }
71
72 void
73 set_dest_ton(argc, argv)
74 char **argv;
75 {
76 char *endp;
77
78 dest_ton = strtoul(argv[1], &endp, 0);
79 if (*endp) {
80 fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
81 input_lineno);
82 exit(1);
83 }
84 }
85
86 void
87 set_dest_npi(argc, argv)
88 char **argv;
89 {
90 char *endp;
91
92 dest_npi = strtoul(argv[1], &endp, 0);
93 if (*endp) {
94 fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
95 input_lineno);
96 exit(1);
97 }
98 }
99
100 void
101 set_pid_byte(argc, argv)
102 char **argv;
103 {
104 char *endp;
105
106 pid_byte = strtoul(argv[1], &endp, 0);
107 if (*endp) {
108 fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
109 input_lineno);
110 exit(1);
111 }
112 }
113
114 void
115 set_dcs_byte(argc, argv)
116 char **argv;
117 {
118 char *endp;
119
120 dcs_byte = strtoul(argv[1], &endp, 0);
121 if (*endp) {
122 fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
123 input_lineno);
124 exit(1);
125 }
126 }
127
128 void
129 set_esm_class(argc, argv)
130 char **argv;
131 {
132 char *endp;
133
134 esm_class = strtoul(argv[1], &endp, 0);
135 if (*endp) {
136 fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
137 input_lineno);
138 exit(1);
139 }
140 }
141
142 void
143 set_priority(argc, argv)
144 char **argv;
145 {
146 char *endp;
147
148 prio_flag = strtoul(argv[1], &endp, 0);
149 if (*endp) {
150 fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
151 input_lineno);
152 exit(1);
153 }
154 }
155
156 void
157 set_reg_deliv(argc, argv)
158 char **argv;
159 {
160 char *endp;
161
162 reg_deliv = strtoul(argv[1], &endp, 0);
163 if (*endp) {
164 fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
165 input_lineno);
166 exit(1);
167 }
168 }
169
170 void
171 set_replace_flag(argc, argv)
172 char **argv;
173 {
174 char *endp;
175
176 replace_flag = strtoul(argv[1], &endp, 0);
177 if (*endp) {
178 fprintf(stderr, ERR_PREFIX "invalid byte value argument\n",
179 input_lineno);
180 exit(1);
181 }
182 }