libs/stream_message/src/startprocess.cxx
// ===========================================================================
// To manage a command line on Windows, it is necessary to transform a
// single string into a list of strings.  The arguments found in cmdline
// are appended to the given cmdargs list.
//
// Backslashes and double-quotes are respected.
// 
To manage a command line on Windows, it is necessary to transform a
single string into a list of strings.  The arguments found in cmdline
are appended to the given cmdargs list.

Backslashes and double-quotes are respected.
To manage a command line on Windows it is necessary to transform a single string into a list of strings . The arguments found in cmdline are appended to the given cmdargs list . Backslashes and double - quotes are respected .
void MBDriver::determine_command_arguments(const string &cmdline,
					   list<string> &cmdargs) {
    const char *p = cmdline.c_str();
    const char *start = NULL;
    string arg;
    bool in_quote = false;
    for (;;) {
        const char ch = *p;
        if (start != NULL && (ch == '\0' || (ch == ' ' && !in_quote))) {
	    arg.append(start, p - start);
	    cmdargs.push_back(arg);
	    start = NULL;
	}
	if (ch == '\0') {
	    break;
	}
	if (start == NULL && !(ch == ' ' || ch == '\t')) {
	    start = p;
	    arg = "";
	}
	if (start == NULL) {
	}
	else if (ch == '\\' && p[1] == '"') {
	    arg.append(start, p - start);
	    start = p + 1;
	    p = start;
	}
	else if (ch == '"') {
	    in_quote = !in_quote;
	    arg.append(start, p - start);
	    start = p + 1;
	}
	p += 1;
    }
}
void MBDriver :: determine_command_arguments ( const string & cmdline , list < string > & cmdargs ) { const char * p = cmdline . c_str ( ) ; const char * start = NULL ; string arg ; bool in_quote = false ; for ( ; ; ) { const char ch = * p ; if ( start != NULL && ( ch == ' \0 ' || ( ch == ' ' && ! in_quote ) ) ) { arg . append ( start , p - start ) ; cmdargs . push_back ( arg ) ; start = NULL ; } if ( ch == ' \0 ' ) { break ; } if ( start == NULL && ! ( ch == ' ' || ch == ' \t ' ) ) { start = p ; arg = " " ; } if ( start == NULL ) { } else if ( ch == ' \\ ' && p [ 1 ] == ' ' ) { arg . append ( start , p - start ) ; start = p + 1 ; p = start ; } else if ( ch == ' ' ) { in_quote = ! in_quote ; arg . append ( start , p - start ) ; start = p + 1 ; } p += 1 ; } }
To manage a command line on Windows, it is necessary to transform a
single string into a list of strings.
To manage a command line on Windows it is necessary to transform a single string into a list of strings .
// p points to the current command line character being examined. // start indicates the beginning of the string which needs to be // copied to the argument. // Wait for a non-whitespace character.