Removed back AppConfiguration class. Postponed its implementation.
[vlp.git] / src / kernel / kernel.cpp
index 1de50aff97eb9ab5abbc24186abc000eebc1faae..3126480c8cf1f07f052f0feb639e101e15ace3db 100644 (file)
@@ -72,7 +72,6 @@
 #include <netinet/in.h>
 
 #include <libconfig.h>
-#include "AppConfiguration.h"
 
 #define GPATH "loggr"
 #define IPATH "logi"
@@ -304,22 +303,29 @@ void QKernel::LoadConfig(char * fname)
     exit(3);
   }
   /* File exists, so file has been locked. Release it. */
-  fclose(file);
   
   config_init(&cfg);
   
   /* Read the file. If there is an error, report it and exit. */
-  if(!config_read_file(&cfg, fname)) 
+  if(!config_read(&cfg, file)) 
   {
-    AppConfiguration::error(&cfg);
+    fprintf(stderr, "%s! In file %s, line %d\n",
+        config_error_text(&cfg),
+        config_error_file(&cfg),
+        config_error_line(&cfg));
     config_destroy(&cfg);
+    fclose(file);
     exit(3);/* from original code. */
   }
 
   if(!config_lookup_int(&cfg, "node_number", &NodeNumber))
   {
-    AppConfiguration::error(&cfg);
+    fprintf(stderr, "%s! In file %s, '%s' was not found.\n",
+        "Warning",
+        fname,
+        "node_number");
     config_destroy(&cfg);
+    fclose(file);
     exit(3);
   }
   
@@ -327,7 +333,10 @@ void QKernel::LoadConfig(char * fname)
     ConType = (strcmp(str, "explicit") == 0) ? 1 : 2;
   }
   else {
-    AppConfiguration::error(&cfg);
+    fprintf(stderr, "%s! In file %s, '%s' was not found.\n",
+        "Warning",
+        fname,
+        "type");
   }
   
   
@@ -335,24 +344,34 @@ void QKernel::LoadConfig(char * fname)
     ConnectList.append(new ConnectEntry((char*)str));
   }
   else {
-    AppConfiguration::error(&cfg);
+    fprintf(stderr, "%s! In file %s, '%s' was not found.\n",
+        "Warning",
+        fname,
+        "host");
   }
   
   if(config_lookup_string(&cfg, "progdir", &str)){
     strncpy(progdir, str, 256);
   }
   else {
-    AppConfiguration::error(&cfg);
+    fprintf(stderr, "%s! In file %s, '%s' was not found.\n",
+        "Warning",
+        fname,
+        "progdir");
   }
   
   if(config_lookup_string(&cfg, "homedir", &str)){
     strncpy(HomeDir, str, 255);
   }
   else {
-    AppConfiguration::error(&cfg);
+    fprintf(stderr, "%s! In file %s, '%s' was not found.\n",
+        "Warning",
+        fname,
+        "homedir");
   }
   
   config_destroy(&cfg);
+  fclose(file);
 }
 /* +++++++++++++++++++++++++++++++++++++++++++++++ */