예제 #1
0
/////////////////////////////////////
// Name:	CmdInit
// Purpose:	initialize all common
//			commands
// Output:	common commands added
// Return:	none
/////////////////////////////////////
void CmdInit()
{
	CmdAdd(L"cmdlist", CMD_List);
	CmdAdd(L"wait", CMD_Wait);
	CmdAdd(L"exec", CMD_Exec);
	CmdAdd(L"echo", CMD_Echo);
	CmdAdd(L"vstr", CMD_VStr);
}
예제 #2
0
//++ ------------------------------------------------------------------------------------
// Details:	Having previously had the potential command validated and found valid now
//			get the command executed.
//			If the Functionalityity returns MIstatus::failure call GetErrorDescription().
//			This function is used by the application's main thread.
// Type:	Method.
// Args:	vCmd	- (RW) Command object.
// Return:	MIstatus::success - Functionality succeeded.
//			MIstatus::failure - Functionality failed.
// Throws:	None.
//--
bool CMICmdInvoker::CmdExecute( CMICmdBase & vCmd )
{
	bool bOk = CmdAdd( vCmd );

	if( bOk && !vCmd.ParseArgs() )
	{
		// Report command execution failed
		const SMICmdData cmdData( vCmd.GetCmdData() );
		CmdStdout( cmdData );
		CmdDelete( cmdData.id );

		// Proceed to wait or execute next command
		return MIstatus::success;
	}
	
	if( bOk && !vCmd.Execute() )
	{
		// Report command execution failed
		const SMICmdData cmdData( vCmd.GetCmdData() );
		CmdStdout( cmdData );
		CmdDelete( cmdData.id );

		// Proceed to wait or execute next command
		return MIstatus::success;
	}

	bOk = CmdExecuteFinished( vCmd );

	return bOk;
}