Index: Evidence/Config.cc
===================================================================
--- Evidence/Config.cc	(revision 229)
+++ Evidence/Config.cc	(revision 253)
@@ -7,15 +7,14 @@
     "Config/ModifyTime" contains the last modification UNIX time.
   - The contents of the configuration file is available through Config/ConfigData.
-  - The current parser removes all tabs, multiple, leading and trailing spaces, and
-    concatenates lines ending with '+'.
+  - The parser removes all tabs, multiple, leading and trailing spaces, and
+    concatenates all lines until the next item.
 
   A mutex is used for preventing concurrent access to the configuration data from
   the methods rpcHandler() and ConfigChanged().
          
-  Oliver Grimm, April 2010
+  Oliver Grimm, July 2010
 
 \********************************************************************/
 
-#define DEFAULT_CONFIG "../config/Evidence.conf"
 #define SERVER_NAME "Config"
 
@@ -35,15 +34,9 @@
 
   private:
-	struct Item {
-	  string Name;
-	  string Data;
-	};
-	vector<struct Item> List;
-
+	map<string, string> Map;
     FILE *File;	
 	char *FileContent;
     DimService *ConfigModified;
 	DimService *ConfigContent;
-    pthread_mutex_t Mutex;
 
     void rpcHandler();
@@ -67,12 +60,4 @@
   FileContent = NULL;
 
-  // Signaling interferes with inotify() mechnism
-  signal(SIGUSR2, SIG_IGN);
-  
-  // Initialise mutex (errno is not set by pthread_mutex_init())
-  if (pthread_mutex_init(&Mutex, NULL) != 0) {
-    Message(FATAL, "pthread_mutex_init() failed");
-  }
-
   // Open configuration file
   if ((File = fopen(Filename, "r")) == NULL) {
@@ -97,6 +82,4 @@
   delete ConfigContent;
   delete[] FileContent;
-
-  if (pthread_mutex_destroy(&Mutex) != 0) Message(ERROR, "pthread_mutex_destroy() failed");
 }
 
@@ -105,16 +88,11 @@
 void EvidenceConfig::rpcHandler() {
 
-  string Response;
-  
-  // Lock because ConfigChange() might access concurrently
-  if (pthread_mutex_lock(&Mutex) != 0) Message(ERROR, "pthread_mutex_lock() failed in rpcHandler()");
-
+  string Response, Item = ToString((char *) "C", getData(), getSize());
+  
   // Search for config data in list (default response is empty string)
-  for (int i=0; i<List.size(); i++) {
-    if (List[i].Name == getString()) Response = List[i].Data;
-  }
-  
-  // Unlock
-  if (pthread_mutex_unlock(&Mutex) != 0) Message(ERROR, "pthread_mutex_unlock() failed in rpcHandler()");
+  // Lock because ConfigChange() might also access concurrently
+  Lock();
+  if (Map.count(Item) != 0) Response = Map[Item];
+  Unlock();
 
   // Send data and update Status
@@ -122,7 +100,6 @@
     
   Message(INFO, "Client '%s' (ID %d) requested '%s'. Send '%s'.",
-		DimServer::getClientName(),
-		DimServer::getClientId(), 
-		getString(), Response.c_str());
+		DimServer::getClientName(),	DimServer::getClientId(), 
+		Item.c_str(), Response.c_str());
 }
 
@@ -227,13 +204,8 @@
   if (Section.empty() || Parameter.empty() || Data.empty()) return;
 
-  // Prepare new item of configuration list
-  struct Item New;
-  New.Name = Section + ' ' + Parameter;
-  New.Data = Data;
-
   // Add to configuration list
-  if (pthread_mutex_lock(&Mutex) != 0) Message(ERROR, "pthread_mutex_lock() failed in ConfigChanged()");
-  List.push_back(New);
-  if (pthread_mutex_unlock(&Mutex) != 0) Message(ERROR, "pthread_mutex_unlock() failed in ConfigChanged()");
+  Lock();
+  Map[Section + " " + Parameter] = Data;
+  Unlock();
 }
 
@@ -255,7 +227,11 @@
 //
 int main(int argc, char *argv[]) {
-        
-  static EvidenceConfig Config(argc<2 ? DEFAULT_CONFIG : argv[1]);
-
+
+  if (argc != 2) {
+	printf("Usage: %s <Configuration-File>\n", argv[0]);
+	exit(EXIT_FAILURE);
+  }
+  
+  static EvidenceConfig Config(argv[1]);
   int Notify;
   struct inotify_event Event;
@@ -264,5 +240,5 @@
     Config.Message(EvidenceConfig::WARN, "inotify_init() failed, cannot monitor changes of configuration file (%s)\n", strerror(errno));
   }
-  else if (inotify_add_watch(Notify, argc<2 ? DEFAULT_CONFIG : argv[1], IN_MODIFY) == -1) { 
+  else if (inotify_add_watch(Notify, argv[1], IN_MODIFY) == -1) { 
       Config.Message(EvidenceConfig::WARN, "Could not set inotify watch on configuration file (%s)\n", strerror(errno));
 	  close(Notify);
