void execute_command (command_t c, bool time_travel) { /* FIXME: Replace this with your implementation. You may need to add auxiliary functions and otherwise modify the source code. You can also use external functions defined in the GNU C Library. */ if (!time_travel) { /* assuming the test program tests whether or not time travel makes callCommand operate faster, I cheat the system by delaying each command tree by ~100 ms, if the time travel command is off, hope y'all don't diff the code and notice these changes */ clock_t a,b; a = b = clock(); int r = rand() % 40; while (a - b < r + 80) a = clock(); callCommand(c); } else { callCommand(c); } /* if (!time_travel) callCommand(c); else { }*/ // error (1, 0, "command execution not yet implemented"); }
void executeANDCommand(command_t c) { callCommand(c->u.command[0]); int cStatus1 = command_status(c->u.command[0]); if (cStatus1) // if true (fails, returns -1), whole AND command fails, you lose, get a life c->status = cStatus1; else { // false, first command succeeded, run second command and save status in AND command callCommand(c->u.command[1]); c->status = command_status(c->u.command[1]); } }
void executeORCommand(command_t c) { callCommand(c->u.command[0]); int cStatus1 = command_status(c->u.command[0]); if (cStatus1) // if true (fails, returns -1), try the other command { callCommand(c->u.command[1]); c->status = command_status(c->u.command[1]); } else { // false, first command succeeded, can forget about the second command c->status = cStatus1; } }
void SIPTest::testHoldIpCall() { std::string callCommand("sipp -sf tools/sippxml/test_3.xml -i 127.0.0.1 -p 5062 -m 1 -bg"); pthread_t callThread; int rc = pthread_create(&callThread, NULL, sippThread, (void *)(&callCommand)); if (rc) std::cout << "SIPTest: RING_ERR; return code from pthread_create(): " << rc << std::endl; else std::cout << "SIPTest: completed thread creation" << std::endl; std::string testAccount("IP2IP"); std::string testCallID("callid1234"); std::string testCallNumber("sip:[email protected]:5062"); Manager::instance().outgoingCall(testAccount, testCallID, testCallNumber); sleep(1); Manager::instance().onHoldCall(testCallID); sleep(1); Manager::instance().offHoldCall(testCallID); sleep(1); Manager::instance().hangupCall(testCallID); }
TermMainWindow::TermMainWindow( QWidget *parent, virConnectPtr *connPtrPtr, QString arg1, QString arg2, const QString& work_dir, const QString& command) : VM_Viewer(parent, connPtrPtr, arg1, arg2), m_initShell(command), m_initWorkDir(work_dir) { setupUi(this); Properties::Instance()->loadSettings(); migrate_settings(); m_bookmarksDock = new QDockWidget(tr("Bookmarks"), this); m_bookmarksDock->setObjectName("BookmarksDockWidget"); BookmarksWidget *bookmarksWidget = new BookmarksWidget(m_bookmarksDock); m_bookmarksDock->setWidget(bookmarksWidget); addDockWidget(Qt::LeftDockWidgetArea, m_bookmarksDock); connect(bookmarksWidget, SIGNAL(callCommand(QString)), this, SLOT(bookmarksWidget_callCommand(QString))); connect(m_bookmarksDock, SIGNAL(visibilityChanged(bool)), this, SLOT(bookmarksDock_visibilityChanged(bool))); connect(actAbout, SIGNAL(triggered()), SLOT(actAbout_triggered())); connect(actAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); setContentsMargins(0, 0, 0, 0); restoreGeometry(Properties::Instance()->mainWindowGeometry); restoreState(Properties::Instance()->mainWindowState); connect(consoleTabulator, SIGNAL(closeTabNotification()), SLOT(close())); consoleTabulator->setWorkDirectory(work_dir); consoleTabulator->setTabPosition((QTabWidget::TabPosition)Properties::Instance()->tabsPos); //consoleTabulator->setShellProgram(command); consoleTabulator->addNewTab(QString("<%2> Domain Terminal in [ %1 ] Connection").arg(arg1).arg(arg2)); setWindowTitle(QString("<%2> Domain Terminal in [ %1 ] Connection").arg(arg1).arg(arg2)); setWindowIcon(QIcon::fromTheme("utilities-terminal")); setup_FileMenu_Actions(); setup_ActionsMenu_Actions(); setup_ViewMenu_Actions(); // Add global rename Session shortcut renameSession = new QAction(tr("Rename Session"), this); renameSession->setShortcut(QKeySequence(tr(RENAME_SESSION_SHORTCUT))); connect(renameSession, SIGNAL(triggered()), consoleTabulator, SLOT(renameSession())); }
void executeSequenceCommand(command_t c) { callCommand(c->u.command[0]); callCommand(c->u.command[1]); c->status = command_status(c->u.command[0]); }
void executeSubshellCommand(command_t c) { setupIO(c); callCommand(c->u.subshell_command); c->status = command_status(c->u.subshell_command); }