Annotation of mqtt/src/mqtt.c, revision 1.1.1.1.2.8
1.1 misho 1: #include "global.h"
1.1.1.1.2.5 misho 2: #include "rtlm.h"
3:
4:
5: sl_config cfg;
1.1 misho 6:
7:
8: int
9: main(int argc, char **argv)
10: {
1.1.1.1.2.6 misho 11: sqlite3 *acc = NULL, *pub = NULL;
1.1.1.1.2.5 misho 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)) {
1.1.1.1.2.8! misho 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);
1.1.1.1.2.5 misho 26: return 2;
27: }
28:
1.1.1.1.2.8! misho 29: acc = mqttOpenACC(&cfg);
1.1.1.1.2.5 misho 30: if (!acc)
31: goto end;
1.1.1.1.2.8! misho 32: pub = mqttOpenPUB(&cfg);
1.1.1.1.2.6 misho 33: if (!pub)
34: goto end;
1.1.1.1.2.5 misho 35:
1.1.1.1.2.7 misho 36: if (mqttMkDir(&cfg)) {
37: printf("Error:: in statedir #%d - %s\n", errno, strerror(errno));
38: goto end;
39: }
40:
1.1.1.1.2.6 misho 41: printf("success!\n");
1.1.1.1.2.5 misho 42:
43: end:
1.1.1.1.2.8! misho 44: mqttClosePUB(pub);
! 45: mqttCloseACC(acc);
! 46: mqttUnloadRTLM(1);
1.1.1.1.2.5 misho 47: mqttUnloadRTLM(0);
48: UnloadConfig(&cfg);
1.1 misho 49: return 0;
50: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>