#include <iostream>
 
 #include <boost/assert.hpp>
+#include <boost/foreach.hpp>
 
 #include <logfunc.hpp>
 #include <stringfunc.hxx>
     // retrieve the arguments string from within the command string
     const size_t args_begin_pos = CommandStr.find( " " ) + 1;
     const size_t args_end_pos = CommandStr.length();
-    string args = CommandStr.substr( args_begin_pos, args_end_pos );
-    args = escape_shellarg( args );
-
-    return args;
+    std::list< string > args = I2n::split_string(
+            CommandStr.substr( args_begin_pos, args_end_pos ),
+            " ", true);
+    BOOST_FOREACH( string arg, args )
+        arg = escape_shellarg( arg );
+    return I2n::join_string( args, " " );
 }