Annotation of mqtt/src/mqtt.c, revision 1.1.1.1.2.9
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.9! misho 12: FILE *logg = NULL;
1.1.1.1.2.5 misho 13:
14: if (LoadConfig("/etc/mqtt.conf", &cfg)) {
15: printf("Error:: Load config #%d - %s\n", cfg_GetErrno(), cfg_GetError());
16: return 1;
17: }
18: if (!mqttLoadRTLM(&cfg, 0)) {
1.1.1.1.2.8 misho 19: printf("Error:: Can't load RTL ACC module\n");
20: UnloadConfig(&cfg);
21: return 2;
22: }
23: if (!mqttLoadRTLM(&cfg, 1)) {
24: printf("Error:: Can't load RTL PUB module\n");
25: mqttUnloadRTLM(0);
26: UnloadConfig(&cfg);
1.1.1.1.2.5 misho 27: return 2;
28: }
1.1.1.1.2.9! misho 29: if (!mqttLoadRTLM(&cfg, 2)) {
! 30: printf("Error:: Can't load RTL LOG module\n");
! 31: mqttUnloadRTLM(1);
! 32: mqttUnloadRTLM(0);
! 33: UnloadConfig(&cfg);
! 34: return 2;
! 35: }
1.1.1.1.2.5 misho 36:
1.1.1.1.2.8 misho 37: acc = mqttOpenACC(&cfg);
1.1.1.1.2.5 misho 38: if (!acc)
39: goto end;
1.1.1.1.2.8 misho 40: pub = mqttOpenPUB(&cfg);
1.1.1.1.2.6 misho 41: if (!pub)
42: goto end;
1.1.1.1.2.9! misho 43: logg = mqttOpenLOG(&cfg);
! 44: if (!logg)
! 45: goto end;
1.1.1.1.2.5 misho 46:
1.1.1.1.2.7 misho 47: if (mqttMkDir(&cfg)) {
48: printf("Error:: in statedir #%d - %s\n", errno, strerror(errno));
49: goto end;
50: }
51:
1.1.1.1.2.6 misho 52: printf("success!\n");
1.1.1.1.2.5 misho 53:
54: end:
1.1.1.1.2.9! misho 55: mqttCloseLOG(logg);
1.1.1.1.2.8 misho 56: mqttClosePUB(pub);
57: mqttCloseACC(acc);
1.1.1.1.2.9! misho 58: mqttUnloadRTLM(2);
1.1.1.1.2.8 misho 59: mqttUnloadRTLM(1);
1.1.1.1.2.5 misho 60: mqttUnloadRTLM(0);
61: UnloadConfig(&cfg);
1.1 misho 62: return 0;
63: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>