Index: trunk/src/lib/parser/ini_parser/ini_parser.cc
===================================================================
--- trunk/src/lib/parser/ini_parser/ini_parser.cc	(revision 7256)
+++ trunk/src/lib/parser/ini_parser/ini_parser.cc	(revision 7661)
@@ -108,5 +108,5 @@
   if( (stream = fopen (fileName.c_str(), "r")) == NULL)
   {
-    PRINTF(1)("IniParser could not open %s\n", fileName.c_str());
+    PRINTF(1)("IniParser could not open %s for reading\n", fileName.c_str());
     return false;
   }
@@ -216,5 +216,5 @@
   if( (stream = fopen (fileName.c_str(), "w")) == NULL)
   {
-    PRINTF(1)("IniParser could not open %s\n", fileName.c_str());
+    PRINTF(1)("IniParser could not open %s for writing\n", fileName.c_str());
     return false;
   }
@@ -401,5 +401,5 @@
  * @return true if everything is ok false on error
  */
-bool IniParser::editVar(const std::string& entryName, const std::string& value, const std::string& sectionName)
+bool IniParser::editVar(const std::string& entryName, const std::string& value, const std::string& sectionName, bool createMissing)
 {
   std::list<IniSection>::iterator section;
@@ -416,31 +416,25 @@
   if (section == this->sections.end())
   {
-    IniSection sec;
-    sec.comment = "";
-    sec.name = sectionName;
-    section = this->sections.insert(this->sections.end(), sec);
-  }
-
-  if (section == this->sections.end())
-  {
-    PRINTF(2)("section '%s' not found for value '%s'\n", sectionName.c_str(), entryName.c_str());
-    return false;
-  }
-  else
-  {
-    //try find item
-    std::list<IniEntry>::iterator entry;
-    for (entry = section->entries.begin(); entry!=section->entries.end(); entry++)
-      if (entry->name == entryName )
+    this->addSection(sectionName);
+    for (section = this->sections.begin(); section != this->sections.end(); section++)
+      if ((*section).name == sectionName)
         break;
-
-    //found it?
-    if ( entry != section->entries.end() )
-    {
-      entry->value = value;
-
-      return true;
-    }
-
+  }
+
+  //try find item
+  std::list<IniEntry>::iterator entry;
+  for (entry = section->entries.begin(); entry!=section->entries.end(); entry++)
+    if (entry->name == entryName )
+      break;
+
+  //found it?
+  if ( entry != section->entries.end() )
+  {
+    entry->value = value;
+
+    return true;
+  }
+  else
+  {
     //not found -> create it
     (*section).entries.push_back(IniEntry());
@@ -448,11 +442,12 @@
     (*section).entries.back().name = entryName;
     (*section).entries.back().value = value;
-    PRINTF(5)("Added Entry %s with Value '%s' to Section %s\n",
-    (*section).entries.back().name.c_str(),
-    (*section).entries.back().value.c_str(),
-    (*section).name);
+    PRINTF(5)("Added Entry '%s' with Value '%s' to Section '%s'\n",
+              (*section).entries.back().name.c_str(),
+              (*section).entries.back().value.c_str(),
+              (*section).name);
     this->currentEntry = --(*section).entries.end();
     return true;
   }
+  return false;
 }
 
@@ -725,10 +720,12 @@
 void IniParser::debug() const
 {
-  PRINTF(0)("Iniparser %s - debug\n", this->fileName.c_str());
+  PRINT(0)("Iniparser '%s' - debug\n", this->fileName.c_str());
   if (!this->comment.empty())
-    PRINTF(0)("FileComment:\n %s\n\n", this->comment.c_str());
+    PRINT(0)("FileComment:\n '%s'\n\n", this->comment.c_str());
 
   if (!this->fileName.empty())
   {
+    if (sections.empty())
+      PRINT(0)("No Sections defined\n");
     std::list<IniSection>::const_iterator section;
     for (section = this->sections.begin(); section != this->sections.end(); section++)
@@ -737,4 +734,7 @@
         PRINTF(0)(" %s\n", (*section).comment.c_str());
       PRINTF(0)(" [%s]\n", (*section).name.c_str());
+
+      if ((*section).entries.empty())
+        PRINT(0)("No Entries defined within Section '%s'\n", (*section).name.c_str());
 
       std::list<IniEntry>::const_iterator entry;
@@ -748,5 +748,5 @@
   }
   else
-    PRINTF(1)("no opened ini-file.\n");
-}
-
+    PRINTF(0)("no opened ini-file.\n");
+}
+
Index: trunk/src/lib/parser/ini_parser/ini_parser.h
===================================================================
--- trunk/src/lib/parser/ini_parser/ini_parser.h	(revision 7256)
+++ trunk/src/lib/parser/ini_parser/ini_parser.h	(revision 7661)
@@ -10,10 +10,7 @@
 
 #define PARSELINELENGHT     512       //!< how many chars to read at once
-#ifndef NULL
- #define NULL 0x0                     //!< NULL
-#endif
 
+#include "src/lib/util/file.h"
 #include <list>
-#include <string>
 
 //! ini-file parser
@@ -21,5 +18,5 @@
  * This class can be used to load an initializer file and parse it's contents for variablename=value pairs.
  */
-class IniParser
+class IniParser : public File
 {
   private:
@@ -47,5 +44,5 @@
 
     /** @returns true if the file is opened, false otherwise*/
-    bool isOpen() const { return (!this->fileName.empty())? true : false; };
+    bool isOpen() const { return true; } ///HACK //(this->fileName.empty()) ? false : true; };
     /** @returns the fileName we have opened. */
     const std::string& getFileName() const { return this->fileName; };
@@ -69,5 +66,5 @@
     bool addVar(const std::string& entryName, const std::string& value, const std::string& sectionName = "" );
     const std::string& getVar(const std::string& entryName, const std::string& sectionName, const std::string& defaultValue = "") const;
-    bool IniParser::editVar(const std::string& entryName, const std::string& value, const std::string& sectionName = "");
+    bool IniParser::editVar(const std::string& entryName, const std::string& value, const std::string& sectionName = "", bool createMissing = true);
     void setEntryComment(const std::string& comment, const std::string& entryName, const std::string& sectionName);
     const std::string& getEntryComment(const std::string& entryName, const std::string& sectionName) const;
