51 lines
985 B
C
51 lines
985 B
C
|
|
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
|
|
#include <logger.h>
|
|
#include <tconfig.h>
|
|
#include <massert.h>
|
|
|
|
|
|
int server_init(void) {
|
|
logger_dprintf("server inited");
|
|
return 0;
|
|
}
|
|
|
|
#define SERVER_CONFIG_ERROR -1
|
|
|
|
int server_config(void) {
|
|
logger_dprintf("server configi");
|
|
|
|
tconfig_t tconfig;
|
|
tconfig_init(&tconfig);
|
|
|
|
char* logpath = NULL;
|
|
tconfig_bind(&tconfig, TCONF_STR, "logpath", &logpath);
|
|
ssize_t rsize = tconfig_read(&tconfig, "helmet.conf");
|
|
if (rsize < 0) {
|
|
return SERVER_CONFIG_ERROR;
|
|
}
|
|
int res = tconfig_parse(&tconfig);
|
|
if (res < 0) {
|
|
return SERVER_CONFIG_ERROR;
|
|
}
|
|
|
|
tconfig_destroy(&tconfig);
|
|
logger_dprintf("logpath = %s", logpath);
|
|
|
|
clconfig_t tconfig;
|
|
tconfig_init(&tconfig);
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
int server_run(void) {
|
|
logger_dprintf("server started");
|
|
return 0;
|
|
}
|