Index: Evidence/Config/Config.cc
===================================================================
--- Evidence/Config/Config.cc	(revision 128)
+++ Evidence/Config/Config.cc	(revision 142)
@@ -5,8 +5,10 @@
   - The configuration file is opened without buffering to catch changes
     without closing/opening.
-  - If a configuration file change is detected through inotify, the service "Config/Modified"
-    is updated (it contains no data) to inform applications. 
-  - The employed line buffer has conservatively at least the size of the configuration file. If
-    needed, it will be enlarged.
+  - The name of a configuration file can be given as command line argument
+  - If a configuration file change is detected through inotify, the service
+    "Config/ModifyTime" is updated with the current UNIX time to inform applications.
+	The initial value of the server is the last file modification time. 
+  - The employed line buffer has conservatively at least the size of the
+    configuration file. If needed, it will be enlarged.
          
   Oliver Grimm, November 2009
@@ -14,8 +16,9 @@
 \********************************************************************/
 
-#define CONFIG_FILE "configuration.txt"
+#define DEFAULT_CONFIG "configuration.txt"
 #define SERVER_NAME "Config"
 
 #include "../Evidence.h"
+#include <ctype.h>
 #include <sys/stat.h>
 #include <sys/inotify.h>
@@ -31,5 +34,6 @@
     unsigned int BufferLength;
     DimService *ConfigModified;
-
+    int ModifyTime;
+	
     void rpcHandler();
   
@@ -45,15 +49,21 @@
 	DimRpc("ConfigRequest", "C", "C"), EvidenceServer(SERVER_NAME) {
 
-  // Create DIM service to indicate changes of configuration file
-  ConfigModified = new DimService (SERVER_NAME"/Modified", (char *) "");
-
   // Open configuration file
   if ((File = fopen(Filename, "r")) == NULL) {
-    Msg(FATAL, "Could not open configuration file '%s' (%s)\n", Filename, strerror(errno));
+    State(FATAL, "Could not open configuration file '%s' (%s)\n", Filename, strerror(errno));
   }
 
+  // Create DIM service to indicate changes of configuration file
+  struct stat Stat;
+  if (stat(Filename, &Stat) == -1) {
+    State(WARN, "Could not read last modification time of configuration file '%s' (%s)", Filename, strerror(errno));
+	ModifyTime = 0;
+  }
+  else ModifyTime = Stat.st_mtime;   
+  ConfigModified = new DimService (SERVER_NAME"/ModifyTime", ModifyTime);
+
   // Disable buffering, so file modifications are immediately seen
-  if(setvbuf(File, NULL, _IONBF, 0) != 0) {
-    Msg(WARN, "Error setting configuration file '%s' to unbuffered mode.\n", Filename);
+  if (setvbuf(File, NULL, _IONBF, 0) != 0) {
+    State(WARN, "Error setting configuration file '%s' to unbuffered mode", Filename);
   }
     
@@ -77,5 +87,5 @@
   // Check if Buffer[] is large enough to hold full file, enlarge if necessary
   if (fstat(fileno(File), &FileStatus) == -1) {
-     Msg(ERROR, "Could not determine size of configuration file to allocate buffer (%s)\n", strerror(errno));
+     State(FATAL, "Could not determine size of configuration file to allocate buffer (%s)", strerror(errno));
   }
   else if(BufferLength < FileStatus.st_size) {
@@ -105,11 +115,16 @@
     if(Token1==NULL || Token2==NULL || Token3==NULL) continue;
 
-    // Check for match and then send data
+    // Check for match and then send data (removing trainlin whitespace)
     if (strstr(Request, Token1)!=NULL && strstr(Request, Token2)!=NULL) {
+	  while (isspace(*Token3) != 0) Token3++;
       setData(Token3);
       break;
     }
   }
-  Msg(INFO, "Client '%s' (ID %d) requested '%s'. Send '%s'.",
+  
+  // If configuration data not found, send empty string
+  if (feof(File)!=0) setData((char *) "");
+  
+  State(INFO, "Client '%s' (ID %d) requested '%s'. Send '%s'.",
 		DimServer::getClientName(),
 		DimServer::getClientId(), 
@@ -120,4 +135,5 @@
 void EvidenceConfig::ConfigChanged() {
 
+  ModifyTime = time(NULL);
   ConfigModified->updateService();
 }
@@ -126,7 +142,7 @@
 // Declaring class static ensures destructor is called when exit() is invoked 
 //
-int main() {
+int main(int argc, char *argv[]) {
         
-  static EvidenceConfig Config(CONFIG_FILE);
+  static EvidenceConfig Config(argc<2 ? DEFAULT_CONFIG : argv[1]);
 
   int Notify;
@@ -134,8 +150,8 @@
   
   if ((Notify = inotify_init()) == -1) {
-    Config.Msg(EvidenceConfig::WARN, "inotify_init() failed, cannot monitor changes of configuration file (%s)\n", strerror(errno));
+    Config.State(EvidenceConfig::WARN, "inotify_init() failed, cannot monitor changes of configuration file (%s)\n", strerror(errno));
   }
-  else if (inotify_add_watch(Notify, CONFIG_FILE, IN_MODIFY) == -1) { 
-      Config.Msg(EvidenceConfig::WARN, "Could not set inotify watch on configuration file (%s)\n", strerror(errno));
+  else if (inotify_add_watch(Notify, argc<2 ? DEFAULT_CONFIG : argv[1], IN_MODIFY) == -1) { 
+      Config.State(EvidenceConfig::WARN, "Could not set inotify watch on configuration file (%s)\n", strerror(errno));
 	  close(Notify);
 	  Notify = -1;
Index: Evidence/Config/Makefile
===================================================================
--- Evidence/Config/Makefile	(revision 128)
+++ Evidence/Config/Makefile	(revision 142)
@@ -2,5 +2,5 @@
 
 PROG=Config
-CPPFLAGS += -I../DIM/ 
+CPPFLAGS += -I../DIM/
 LDLIBS += -lpthread
 
