- wxArrayString args;
-
- const char *cptr = command.c_str();
-
- // split the command line in arguments
- //
- // TODO: combine this with wxCmdLineParser::ConvertStringToArgs(), it
- // doesn't do exactly the same thing right now but it's pretty close
- // and we shouldn't maintain 2 copies of this code
- do
- {
- wxString argument;
- char quotechar = '\0'; // is arg quoted?
- bool escaped = false;
-
- // eat leading whitespace:
- while ( wxIsspace(*cptr) )
- cptr++;
-
- if ( *cptr == '\'' || *cptr == '"' )
- quotechar = *cptr++;
-
- do
- {
- if ( *cptr == '\\' && !escaped )
- {
- escaped = true;
- cptr++;
- continue;
- }
-
- // all other characters:
- argument += *cptr++;
- escaped = false;
-
- // have we reached the end of the argument?
- if ( (*cptr == quotechar && !escaped)
- || (quotechar == '\0' && wxIsspace(*cptr))
- || *cptr == '\0' )
- {
- args.push_back(argument);
-
- // if not at end of buffer, swallow last character:
- if ( *cptr )
- cptr++;
-
- break; // done with this one, start over
- }
- } while ( *cptr );
- } while ( *cptr );
+ ArgsArray argv(wxCmdLineParser::ConvertStringToArgs(command,
+ wxCMD_LINE_SPLIT_UNIX));