libs/stream_message/src/startprocess.cxx
// ===========================================================================
// Translate the arg list into a single-string command.
//
// detach_flag argument is used while creating the new process. It is a 
// default argument and its value is set to 0. 
// If detach_flag 
//	= 1, make the new process a detached one 
//	= 2, create a new process group
//  = otherwise make the new process child of the current process
//
Translate the arg list into a single-string command.
detach_flag argument is used while creating the new process. It is a
default argument and its value is set to 0.
If detach_flag
1, make the new process a detached one
2, create a new process group
otherwise make the new process child of the current process
Translate the arg list into a single - string command . detach_flag argument is used while creating the new process . It is a default argument and its value is set to 0 . If detach_flag 1 make the new process a detached one 2 create a new process group otherwise make the new process child of the current process
static MBDriver::pid_t start(const char *pathp, const char *const argv[],
                             int detach_flag, HANDLE *hOutputRead,
			     processIdType& process_id)
{
    list<string> arg_list;
    arg_list.push_back(pathp);
    for (int i = 0;; i += 1) {
	const char *arg = argv[i];
	if (arg == NULL) {
	    break;
	}
	arg_list.push_back(arg);
    }
    string cmd = prepare_command_arguments(arg_list);
    char *cmd_buf = new char[cmd.length() + 1];
    strcpy(cmd_buf, cmd.c_str());
    string path = pathp;
    int length = path.size();
    const char *tail = pathp + (length - 4);
    if (length >= 4 && (strcmp(tail, ".exe") == 0 || strcmp(tail, ".EXE") == 0)) {
    }
    else {
	path.append(".exe");
    }
    MBDriver::pid_t result;
    if (detach_flag == 2)
        result = startProcessGroup(cmd_buf);
    else
        result = start_cmd(path.c_str(), cmd_buf, detach_flag, hOutputRead, process_id);
    delete [] cmd_buf;
    return result;
}
static MBDriver :: pid_t start ( const char * pathp , const char * const argv [ ] , int detach_flag , HANDLE * hOutputRead , processIdType & process_id ) { list < string > arg_list ; arg_list . push_back ( pathp ) ; for ( int i = 0 ; ; i += 1 ) { const char * arg = argv [ i ] ; if ( arg == NULL ) { break ; } arg_list . push_back ( arg ) ; } string cmd = prepare_command_arguments ( arg_list ) ; char * cmd_buf = new char [ cmd . length ( ) + 1 ] ; strcpy ( cmd_buf , cmd . c_str ( ) ) ; string path = pathp ; int length = path . size ( ) ; const char * tail = pathp + ( length - 4 ) ; if ( length >= 4 && ( strcmp ( tail , " " ) == 0 || strcmp ( tail , " " ) == 0 ) ) { } else { path . append ( " " ) ; } MBDriver :: pid_t result ; if ( detach_flag == 2 ) result = startProcessGroup ( cmd_buf ) ; else result = start_cmd ( path . c_str ( ) , cmd_buf , detach_flag , hOutputRead , process_id ) ; delete [ ] cmd_buf ; return result ; }
Translate the arg list into a single-string command.
Translate the arg list into a single - string command .
// Prepare command string in a writable buffer. // Prepare path of executable. // append .exe //name of executable occurs first in cmd_buf