1: #include "global.h"
2: #include "rtlm.h"
3:
4:
5: sl_config cfg;
6:
7:
8: int
9: main(int argc, char **argv)
10: {
11: sqlite3 *acc = NULL, *pub = NULL;
12:
13: if (LoadConfig("/etc/mqtt.conf", &cfg)) {
14: printf("Error:: Load config #%d - %s\n", cfg_GetErrno(), cfg_GetError());
15: return 1;
16: }
17: if (!mqttLoadRTLM(&cfg, 0)) {
18: printf("Error:: Can't load RTL ACC module\n");
19: UnloadConfig(&cfg);
20: return 2;
21: }
22: if (!mqttLoadRTLM(&cfg, 1)) {
23: printf("Error:: Can't load RTL PUB module\n");
24: mqttUnloadRTLM(0);
25: UnloadConfig(&cfg);
26: return 2;
27: }
28:
29: acc = mqttOpenACC(&cfg);
30: if (!acc)
31: goto end;
32: pub = mqttOpenPUB(&cfg);
33: if (!pub)
34: goto end;
35:
36: if (mqttMkDir(&cfg)) {
37: printf("Error:: in statedir #%d - %s\n", errno, strerror(errno));
38: goto end;
39: }
40:
41: printf("success!\n");
42:
43: end:
44: mqttClosePUB(pub);
45: mqttCloseACC(acc);
46: mqttUnloadRTLM(1);
47: mqttUnloadRTLM(0);
48: UnloadConfig(&cfg);
49: return 0;
50: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>