string result;
bool need_quotes = false;
bool backslash = false;
- for(string::const_iterator i=arg.begin(); i!=arg.end(); ++i)
+ for(char c: arg)
{
- if(*i=='\\')
+ if(c=='\\')
backslash = true;
- else if(*i=='"')
+ else if(c=='"')
{
if(backslash)
result += '\\';
result += '\\';
}
- else if(*i==' ')
+ else if(c==' ')
need_quotes = true;
- result += *i;
+ result += c;
}
if(need_quotes)
void Process::execute(const string &command, bool path_search, const Arguments &args)
{
string cmdline = quote_argument(command);
- for(Arguments::const_iterator i=args.begin(); i!=args.end(); ++i)
- append(cmdline, " ", quote_argument(*i));
+ for(const string &a: args)
+ append(cmdline, " ", quote_argument(a));
STARTUPINFO startup;
startup.cb = sizeof(STARTUPINFO);