version 1.1.1.1.2.2, 2011/11/29 22:42:23
|
version 1.1.1.1.2.3, 2011/11/29 23:23:31
|
Line 23 int
|
Line 23 int
|
main(int argc, char **argv) |
main(int argc, char **argv) |
{ |
{ |
char ch, szCfgName[MAXPATHLEN]; |
char ch, szCfgName[MAXPATHLEN]; |
|
register int i; |
|
sqlite3 *acc = NULL, *pub = NULL; |
|
FILE *logg = NULL; |
|
|
strlcpy(szCfgName, DEFAULT_CONFIG, sizeof szCfgName); |
strlcpy(szCfgName, DEFAULT_CONFIG, sizeof szCfgName); |
while ((ch = getopt(argc, argv, "hvc:")) != -1) |
while ((ch = getopt(argc, argv, "hvc:")) != -1) |
Line 45 main(int argc, char **argv)
|
Line 48 main(int argc, char **argv)
|
printf("Error:: can't load #%d - %s\n", cfg_GetErrno(), cfg_GetError()); |
printf("Error:: can't load #%d - %s\n", cfg_GetErrno(), cfg_GetError()); |
return 1; |
return 1; |
} |
} |
|
for (i = 0; i < 3; i++) |
|
if (!mqttLoadRTLM(&cfg, i)) { |
|
printf("Error:: Can't load RTL module\n"); |
|
while (i--) |
|
mqttUnloadRTLM(i); |
|
UnloadConfig(&cfg); |
|
return 2; |
|
} |
|
acc = call.OpenACC(&cfg); |
|
if (!acc) |
|
goto end; |
|
pub = call.OpenPUB(&cfg); |
|
if (!pub) |
|
goto end; |
|
logg = call.OpenLOG(&cfg); |
|
if (!logg) |
|
goto end; |
|
|
|
if (mqttMkDir(&cfg)) { |
|
printf("Error:: in statedir #%d - %s\n", errno, strerror(errno)); |
|
goto end; |
|
} |
|
|
|
VERB(2) printf("Service is ready for start engine ...\n"); |
|
|
|
end: |
|
call.CloseLOG(logg); |
|
call.ClosePUB(pub); |
|
call.CloseACC(acc); |
|
for (i = 0; i < 3; i++) |
|
mqttUnloadRTLM(i); |
UnloadConfig(&cfg); |
UnloadConfig(&cfg); |
return 0; |
return 0; |
} |
} |