Index: /trunk/FACT++/src/tools.cc
===================================================================
--- /trunk/FACT++/src/tools.cc	(revision 13666)
+++ /trunk/FACT++/src/tools.cc	(revision 13667)
@@ -11,4 +11,6 @@
 
 #include <stdarg.h>
+
+#include <boost/tokenizer.hpp>
 
 using namespace std;
@@ -140,2 +142,52 @@
     return rc;
 }
+
+// --------------------------------------------------------------------------
+//
+//! Splits a string into a filename and command line arguments, like:
+//!
+//!    file.txt arg1=argument1 arg2="argument 2" arg3="argument \"3\""
+//!
+//! 'file.txt' will be returned on opt, the arguments will be returned in
+//! the returned map.
+//!
+//! If the returned file name is empty, an error has occured:
+//!   If the map is also empty the file name was empty, if the map has
+//!   one entry then for this entry the euqal sign was missing.
+//!
+map<string,string> Tools::Split(string &opt)
+{
+    using namespace boost;
+    typedef escaped_list_separator<char> separator;
+
+    const string data(opt);
+
+    const tokenizer<separator> tok(data, separator('\\', ' ', '\"'));
+
+    auto it=tok.begin();
+    if (it==tok.end())
+    {
+        opt = "";
+        return map<string,string>();
+    }
+
+    opt = *it++;
+
+    map<string,string> rc;
+
+    for (; it!=tok.end(); it++)
+    {
+        const size_t pos = it->find_first_of('=');
+        if (pos==string::npos)
+        {
+            opt = "";
+            rc.clear();
+            rc[*it] = "";
+            return rc;
+        }
+
+        rc[it->substr(0, pos)] = it->substr(pos+1);
+    }
+
+    return rc;
+}
Index: /trunk/FACT++/src/tools.h
===================================================================
--- /trunk/FACT++/src/tools.h	(revision 13666)
+++ /trunk/FACT++/src/tools.h	(revision 13667)
@@ -2,4 +2,5 @@
 #define FACT_Tools
 
+#include <map>
 #include <string>
 
@@ -11,4 +12,6 @@
     std::string TrimQuotes(const std::string &str);
     std::string Wrap(std::string &str, size_t width=78);
+
+    std::map<std::string,std::string> Split(std::string &);
 }
 
