]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/config.cpp
Made config.cpp output errors now that it's a true daemon!
[irc/gameservirc.git] / gameserv / config.cpp
index 3426a67ddc1d03c73a0cd90bea62e703be710c55..c43f01411faa2b0d1817067063a5c1cd03d54f84 100644 (file)
@@ -1,9 +1,13 @@
-#include <fstream.h>
+#include <fstream>
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include "extern.h"
 
+using std::ifstream;
+using std::cerr;
+using std::endl;
+
 void load_config_file(char *config);
 void unload_config_file();
 
@@ -30,6 +34,10 @@ char *remotepass;            // Password for the server link
 char *playerdata;              // File to store player data in
 char *monsterdata;             // File to load monster data from
 
+#if defined(P10)
+       char *gsnum = "[]AAA";          // GameServ Numeric
+#endif
+
 void unload_config_file()
 {
     if (s_GameServ)
@@ -71,6 +79,7 @@ void load_config_file(char *config)
     infile.open(config);
     if (infile.fail())
     {
+       log("Error opening %s", config);
        cerr << "Error opening " << config << endl;
        return;
     }
@@ -78,7 +87,7 @@ void load_config_file(char *config)
     while (infile.getline(buf, 1024, '\n'))
     {
        #ifdef DEBUGMODE
-           log("Buf: %s", buf);
+           log("Config file entry buf: %s", buf);
        #endif
 
        if (buf[0] == '#' || buf[0] == ' ' || buf[0] == '\0' || buf[0] == '\n' || buf[0] == '\r')
@@ -89,7 +98,9 @@ void load_config_file(char *config)
         if (stricmp(directive, "DIE") == 0)
        {
            value = strtok(NULL, "");
-           cerr << value << endl;
+           log("You should read the entire %s file!", config);
+           cerr << "You should read the entire " << config << " file!" 
+                << endl;
            exit(0);
        }
        if (stricmp(directive, "S_GAMESERV") == 0)
@@ -189,6 +200,8 @@ void load_config_file(char *config)
        {
            #ifdef DEBUGMODE
                log("Unknown Directive. Buffer: %s", buf);
+               cerr << "Unknown " << config << " directive. Buffer: " 
+                    << buf << endl;
            #endif
            continue;
        }