summaryrefslogtreecommitdiff
path: root/server/miav_server.cc
diff options
context:
space:
mode:
authordeva <deva>2006-08-16 23:49:23 +0000
committerdeva <deva>2006-08-16 23:49:23 +0000
commit347b1d8ed3a4f780f3a5c0d57a04eab05ca517a2 (patch)
treedc21975923fb440c78ee4bbffc645a138071978f /server/miav_server.cc
parent6c07f9219bed6ccddc9b65ad40414cf0a9f7d633 (diff)
Replaced the old MiavConfig class with the new Configuration class in all the the appropriate places.
Crippled the MulticastConfiguration class. This must be rewritten to use the new configuration interface.
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