本文整理汇总了C++中RunCommand函数的典型用法代码示例。如果您正苦于以下问题:C++ RunCommand函数的具体用法?C++ RunCommand怎么用?C++ RunCommand使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RunCommand函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetDifficulty
static void SetDifficulty(int difficulty,
int total_think_time_secs,
int per_turn_think_time_secs) {
// Disable background thinking. I don't know how to stop it in timely
// fashion.
RunCommand("ponder off");
// Don't let the computer resign until it's really desperate.
RunCommand("resign 999999");
node_limit = UINT64_MAX;
sec_limit = total_think_time_secs;
sec_limit_up = per_turn_think_time_secs;
if (difficulty == 0) {
depth_limit = 1;
} else if (difficulty == 1) {
depth_limit = 2;
} else if (difficulty == 2) {
depth_limit = 4;
} else if (difficulty == 3) {
depth_limit = 6;
} else {
depth_limit = PLY_MAX;
}
LOG_DEBUG("Set difficulty: #node=%llu #depth=%d total=%ds, per_turn=%ds",
node_limit, depth_limit, sec_limit, sec_limit_up);
}
示例2: UplinkAssert
void ConsoleScreenInterface::Update ()
{
if ( !waiting && timesync == -1 && queue.Size () > 0 ) {
// Execute next command
ConsoleCommand *cc = queue.GetData (0);
UplinkAssert (cc);
queue.RemoveData (0);
RunCommand ( cc );
}
else if ( !waiting && timesync > -1 ) {
if ( EclGetAccurateTime () > timesync ) {
timesync = -1;
// Execute next command
ConsoleCommand *cc = queue.GetData (0);
UplinkAssert (cc);
queue.RemoveData (0);
RunCommand ( cc );
}
}
}
示例3: switch
void CGitPropertyPage::PageProcOnCommand(WPARAM wParam)
{
if(HIWORD(wParam) != BN_CLICKED)
return;
switch (LOWORD(wParam))
{
case IDC_SHOWLOG:
{
tstring gitCmd = _T(" /command:");
gitCmd += _T("log /path:\"");
gitCmd += filenames.front().c_str();
gitCmd += _T("\"");
RunCommand(gitCmd);
}
break;
case IDC_SHOWSETTINGS:
{
CTGitPath path(filenames.front().c_str());
CString projectTopDir;
if(!path.HasAdminDir(&projectTopDir))
return;
tstring gitCmd = _T(" /command:");
gitCmd += _T("settings /path:\"");
gitCmd += projectTopDir;
gitCmd += _T("\"");
RunCommand(gitCmd);
}
break;
case IDC_ASSUMEVALID:
case IDC_SKIPWORKTREE:
case IDC_EXECUTABLE:
case IDC_SYMLINK:
BOOL executable = (BOOL)SendMessage(GetDlgItem(m_hwnd, IDC_EXECUTABLE), BM_GETCHECK, 0, 0);
BOOL symlink = (BOOL)SendMessage(GetDlgItem(m_hwnd, IDC_SYMLINK), BM_GETCHECK, 0, 0);
if (executable == BST_CHECKED)
{
EnableWindow(GetDlgItem(m_hwnd, IDC_SYMLINK), FALSE);
SendMessage(GetDlgItem(m_hwnd, IDC_SYMLINK), BM_SETCHECK, BST_UNCHECKED, 0);
}
else
EnableWindow(GetDlgItem(m_hwnd, IDC_SYMLINK), TRUE);
if (symlink == BST_CHECKED)
{
EnableWindow(GetDlgItem(m_hwnd, IDC_EXECUTABLE), FALSE);
SendMessage(GetDlgItem(m_hwnd, IDC_EXECUTABLE), BM_SETCHECK, BST_UNCHECKED, 0);
}
else
EnableWindow(GetDlgItem(m_hwnd, IDC_EXECUTABLE), TRUE);
m_bChanged = true;
SendMessage(GetParent(m_hwnd), PSM_CHANGED, (WPARAM)m_hwnd, 0);
break;
}
}
示例4: SetIPRouter
/**
* LANHostConfigManagement:1 Action: SetIPRouter.
*
* Sets the default router.
* This action only affects the default router, not all routers like defined in the spec.
*
* @param ca_event Upnp event struct.
* @return Upnp error code.
*/
int SetIPRouter( struct Upnp_Action_Request *ca_event )
{
char *parmList[] = { ROUTE_COMMAND, NULL, "default", "gw", NULL, NULL };
char addr[LINE_LEN];
char *new_router;
int status;
if ( ( new_router = GetFirstDocumentItem( ca_event->ActionRequest, "NewIPRouters" ) ) &&
( GetNbSoapParameters( ca_event->ActionRequest ) == 1 ) )
{
if ( CheckDHCPServerConfigurable( ca_event ) )
return ca_event->ErrCode;
// if default gateway already exists, delete it
if ( GetDefaultGateway( addr ) )
{
// check that new gateway is different than current
if ( strcmp( new_router, addr ) == 0 )
{
addErrorData( ca_event, 701, "ValueAlreadySpecified" );
trace( 2, "SetIPRouter: new default gw '%s' is the same as current one '%s'", new_router, addr );
free( new_router );
return ca_event->ErrCode;
}
parmList[1] = "del";
parmList[4] = addr;
RunCommand( ROUTE_COMMAND, parmList );
}
// add new default gw
parmList[1] = "add";
parmList[4] = new_router;
status = RunCommand( ROUTE_COMMAND, parmList );
if ( !status )
ParseResult( ca_event, "" );
else
{
trace( 2, "SetIPRouter: Route command returned error: %d", status );
addErrorData( ca_event, 501, "Action Failed" );
}
}
else
InvalidArgs( ca_event );
free( new_router );
return ca_event->ErrCode;
}
示例5: main
int main(int argc, char* argv[])
{
string entry = "build\\app.js";
string port = "3000";
if(argc > 1) entry = argv[1];
if(argc > 2) port = argv[2];
string exePath = GetExePath();
string npmCommand = "start node \"" + exePath + "\\" + entry + "\"";
printf(("starting node in: " + entry + "\n").c_str());
RunCommand(npmCommand);
printf(("starting firefox on localhost:" + port + "\n").c_str());
string browserCommand = "start firefox localhost:" + port;
RunCommand(browserCommand);
return 0;
}
示例6: DoPMake
static int DoPMake( pmake_data *data )
{
pmake_list *curr;
int res;
char cmd[256];
int rc;
res = 0;
for( curr = data->dir_list; curr != NULL; curr = curr->next ) {
rc = chdir( curr->dir_name );
if( rc != 0 ) {
res = rc;
break;
}
if( data->display ) {
fputs( "==== ", stdout );
puts( curr->dir_name );
}
PMakeCommand( data, cmd );
rc = RunCommand( cmd );
if( rc != 0 ) {
res = rc;
if( data->ignore_err == 0 ) {
break;
}
}
}
return( res );
}
示例7: CL_TRACE
Bool CCompiler::RunPreCompileStep( )
{
CL_TRACE("Enter CCompiler::RunPreCompileStep");
//if( !CopyCppFile() )
//{
// CL_ERROR("failed to copy cpp files");
// return false;
//}
if( !CopySourceCode( m_sourceCodeToCompile ) )
{
CL_ERROR("failed to copy source");
return false;
}
// delete output file to have a clean compile log
CPath::DeleteFile( m_compilerOutputFile );
CString pathToSettupBat;
if( !ThGetEnvVariable(ms_vsEnvToolsVar, pathToSettupBat) )
{
CL_ERROR("failed to get path to settup bat from env variable:[%s]", ms_vsEnvToolsVar );
return false;
}
CString vsSettupCommand = "call \"" + pathToSettupBat + ms_vsSetupBat + "\"";
if( !RunCommand(vsSettupCommand) )
{
return false;
}
return true;
}
示例8: GetMatchingProcessIds
QList<unsigned int> GetMatchingProcessIds(QString const& pattern)
{
QList<unsigned int> pids;
QStringList args;
#ifdef Q_OS_WIN32
QString cmd("/Windows/System32/tasklist.exe");
#else
QString cmd("/bin/ps");
// The command,pid ordering is chosen to match the output of tasklist
args << "-x" << "-c" << "-o" << "command,pid";
#endif
QStringList processes(RunCommand(cmd, args));
QStringList tokens;
for (int i = 0; i < processes.count(); ++i) {
if (processes[i].contains(pattern, Qt::CaseInsensitive)) {
qDebug() << "MATCHED!" << processes[i];
tokens = processes[i].split(QRegExp("\\s+"), QString::SkipEmptyParts);
pids.append(tokens[1].toUInt());
}
}
return pids;
}
示例9: main
int main(int argc, char ** argv)
{
WCHAR current_path[MAX_PATH];
GetModuleFileNameW(NULL, current_path, MAX_PATH);
GetDirectory(current_path);
wcscat(current_path, L"x.dll");
GetShortPathNameW(current_path, current_path, MAX_PATH);
WCHAR * traversal = (WCHAR*)malloc(MAX_PATH*2);
memset(traversal, 0, MAX_PATH*2);
for(int j = 0; j < 10; j++)
wcscat(traversal, L"\\..");
wcscat(traversal, current_path+2);
//wprintf(L"TRYING: %s\n", traversal);
DWORD dataLen = wcslen(traversal)*2+2+0x14;
BYTE *data = (BYTE*)malloc(dataLen);
memset(data, 0, dataLen);
memcpy(data+0x11, traversal, wcslen(traversal)*2+2);
HANDLE handle = GetNamedPipeHandle();
if(handle)
{
RunCommand(handle, 0x17, data, dataLen);
}
else
{
printf("Unable to get handler, may be the antivirus service is down!\n");
}
free(data);
free(traversal);
}
示例10: DeleteIPRouter
/**
* LANHostConfigManagement:1 Action: DeleteIPRouter.
*
* Deletes the default router.
* This action only affects the default router, not all routers like defined in the spec.
*
* @param ca_event Upnp event struct.
* @return Upnp error code.
*/
int DeleteIPRouter( struct Upnp_Action_Request *ca_event )
{
char *parmList[] = { ROUTE_COMMAND, "del", "default", "gw", NULL, NULL };
int status;
if ( ( parmList[4] = GetFirstDocumentItem( ca_event->ActionRequest, "NewIPRouters" ) ) &&
( GetNbSoapParameters( ca_event->ActionRequest ) == 1 ) )
{
if ( CheckDHCPServerConfigurable( ca_event ) )
return ca_event->ErrCode;
// run route del command
status = RunCommand( ROUTE_COMMAND, parmList );
if ( !status )
ParseResult( ca_event, "" );
else
{
trace( 2, "DeleteIPRouter: Route command returned error: %d", status );
addErrorData( ca_event, 702, "ValueSpecifiedIsInvalid" );
}
}
else
InvalidArgs( ca_event );
free( parmList[4] );
return ca_event->ErrCode;
}
示例11: Generate_UUID
char * Generate_UUID( NitsCallSite cs)
{
char * uuidString;
uuidString = (char*)RunCommand("cat /proc/sys/kernel/random/uuid | awk '{print toupper($0)}' | tr -d \"\n\"");
return uuidString;
}
示例12: RunCommand
PerforceDepotView::Streams PerforceDepotView::GetStreams()
{
std::string cmd = "streams";
auto results = RunCommand(cmd);
if (!results || results->hasErrors())
return Streams();
std::string output = results->output();
if (output.empty())
return Streams();
size_t start = 0;
std::string token = "\n\n";
auto end = output.find(token);
Streams streams;
while (start != output.length() && end != std::string::npos)
{
auto chunk = output.substr(start, end - start);
if (!chunk.empty())
{
auto info = ParseResults(chunk);
if (info.find("Stream") != info.end())
{
streams[info["Stream"]] = (std::move(info));
}
}
start = end + token.size();
end = output.find("\n\n", start);
}
return streams;
}
示例13: RunPuttyEd
void RunPuttyEd( HWND hwnd ) {
char buffer[1024]="", shortname[1024]="" ;
if( GetModuleFileName( NULL, (LPTSTR)buffer, 1023 ) )
if( GetShortPathName( buffer, shortname, 1023 ) ) {
strcat( shortname, " -ed" );
RunCommand( hwnd, shortname ) ;
}
}
示例14: RunCommands
/** Run the commands in a command list. */
void RunCommands(CommandNode *commands) {
CommandNode *cp;
for(cp = commands; cp; cp = cp->next) {
RunCommand(cp->command);
}
}
示例15: GetWorkingDirectory
status_t
SVNSourceControl::GetChangeStatus(BString &out)
{
BString command;
command << "svn status --non-interactive '" << GetWorkingDirectory() << "'";
RunCommand(command, out);
return B_OK;
}