X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fexternaltask.cpp;h=33ffcebc4622889eaed085e371cc19fbb8a348df;hb=aa053d637e8259755af7d2e4b510a242f4d29c7b;hp=dce0e06d6157700db2efab0ca32a27d5ba26aceb;hpb=f5d23e3e6ad425075182982c1ef717cb0873bbdc;p=builder.git diff --git a/source/externaltask.cpp b/source/externaltask.cpp index dce0e06..33ffceb 100644 --- a/source/externaltask.cpp +++ b/source/externaltask.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -32,16 +31,16 @@ ExternalTask::~ExternalTask() string ExternalTask::get_command() const { string cmd; - for(vector::const_iterator i=argv.begin(); i!=argv.end(); ++i) + for(const string &a: argv) { - if(i!=argv.begin()) + if(!cmd.empty()) cmd += ' '; - for(string::const_iterator j=i->begin(); j!=i->end(); ++j) + for(char c: a) { - if(*j=='"' || *j=='\'' || *j==' ' || *j=='\\' || *j=='&') + if(c=='"' || c=='\'' || c==' ' || c=='\\' || c=='&') cmd += '\\'; - cmd += *j; + cmd += c; } }