summaryrefslogtreecommitdiff
path: root/server/miav_server.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/miav_server.cc')
-rw-r--r--server/miav_server.cc32
1 files changed, 21 insertions, 11 deletions
diff --git a/server/miav_server.cc b/server/miav_server.cc
index 28c45b6..8cd7a42 100644
--- a/server/miav_server.cc
+++ b/server/miav_server.cc
@@ -27,14 +27,15 @@
// For ETC
#include "config.h"
-#include "miav_server.h"
-#include "miav_config.h"
+#include "configuration.h"
#include "info_console.h"
#include <stdio.h>
#include <string.h>
+#include <string>
+
#include "server.h"
#include "socket.h"
#include "network.h"
@@ -120,19 +121,25 @@ int main(int argc, char *argv[])
fprintf(stderr, "Using config file [%s]\n", config_file);
- MiavConfig cfg(config_file);
- MIaV::initConfig(&cfg);
+ Configuration config(config_file);
+ MIaV::initConfig(&config);
InfoConsole info;
MIaV::initInfo(&info);
- string user;
- if(user_opt) user = string(user_opt);
- else user = *cfg.readString("server_user");
+ std::string user;
+ if(user_opt) user = std::string(user_opt);
+ else {
+ if(config.get("server_user", &user))
+ info.error("Could not read symbol [server_user] from the conf file!");
+ }
- string group;
- if(group_opt) group = string(group_opt);
- else group = *cfg.readString("server_group");
+ std::string group;
+ if(group_opt) group = std::string(group_opt);
+ else {
+ if(config.get("server_group", &group))
+ info.error("Could not read symbol [server_group] from the conf file!");
+ }
// Fetch user id
int uid = -1;
@@ -166,7 +173,10 @@ int main(int argc, char *argv[])
fprintf(stderr, "Running in foreground mode.\n");
}
- int port = MIaV::config->readInt("server_port");
+ int port;
+ if(config.get("server_port", &port))
+ info.error("Could not read symbol [server_port] from the conf file!");
+
pid_t childpid; // variable to store the child's pid
signal(SIGCLD, SIG_IGN); // Ved SIGCHILD til IGNORE maa wait/waitpid ikke kaldes