46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
char **dataval;
dataval = data;
*dataval = strdup(value);
return(0);
}
static int lc_process_var_cidr(void *data, const char *value) {
return(0);
}
static int lc_process_var_ip(void *data, const char *value) {
uint32_t *dataval = NULL, retval = 0;
const char *dotptr = NULL;
int tmpval = -1;
dataval = data;
dotptr = value;
while (1) {
tmpval = atoi(dotptr);
if (tmpval < 0) {
break;
}
retval <<= 8;
retval |= tmpval;
dotptr = strpbrk(dotptr, "./ \t");
if (dotptr == NULL) {
break;
}
if (*dotptr != '.') {
break;
}
dotptr++;
}
*dataval = retval;
return(0);
}
static int lc_process_var_longlong(void *data, const char *value) {
long long *dataval;
dataval = data;
*dataval = strtoll(value, NULL, 10);
|
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
|
+
+
+
+
+
+
+
+
+
+
|
short *dataval;
dataval = data;
*dataval = lc_process_size(value);
return(0);
}
static int lc_process_var_sizesizet(void *data, const char *value) {
size_t *dataval;
dataval = data;
*dataval = lc_process_size(value);
return(0);
}
static int lc_handle_type(lc_var_type_t type, const char *value, void *data) {
switch (type) {
case LC_VAR_STRING:
return(lc_process_var_string(data, value));
break;
case LC_VAR_LONG_LONG:
|
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
|
+
+
+
+
+
+
|
break;
case LC_VAR_SIZE_SHORT:
return(lc_process_var_sizeshort(data, value));
break;
case LC_VAR_BOOL_BY_EXISTANCE:
return(lc_process_var_bool_byexistance(data, value));
break;
case LC_VAR_SIZE_SIZE_T:
return(lc_process_var_sizesizet(data, value));
break;
case LC_VAR_IP:
return(lc_process_var_ip(data, value));
break;
case LC_VAR_TIME:
case LC_VAR_DATE:
case LC_VAR_FILENAME:
case LC_VAR_DIRECTORY:
#ifdef DEBUG
fprintf(stderr, "Not implemented yet!\n");
#endif
|