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 module\n");
19: return 2;
20: }
21:
22: acc = mqttOpenDB(&cfg, 0);
23: if (!acc)
24: goto end;
25: pub = mqttOpenDB(&cfg, 1);
26: if (!pub)
27: goto end;
28:
29: if (mqttMkDir(&cfg)) {
30: printf("Error:: in statedir #%d - %s\n", errno, strerror(errno));
31: goto end;
32: }
33:
34: printf("success!\n");
35:
36: end:
37: mqttCloseDB(pub);
38: mqttCloseDB(acc);
39: mqttUnloadRTLM(0);
40: UnloadConfig(&cfg);
41: return 0;
42: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>