int ConsoleFinder::RunConsole(const wxString &title) { // start the xterm and put the shell to sleep with -e sleep 80000 // fetch the xterm tty so we can issue to gdb a "tty /dev/pts/#" // redirecting program stdin/stdout/stderr to the xterm console. #ifndef __WXMSW__ wxString cmd; cmd = GetConsoleCommand(); cmd.Replace(wxT("$(TITLE)"), title); cmd.Replace(wxT("$(CMD)"), wxString::Format(wxT("sleep %lu"), 80000 + wxGetProcessId())); wxLogMessage(wxString::Format(wxT("Launching console: %s"), cmd.c_str())); m_nConsolePid = wxExecute(cmd, wxEXEC_ASYNC|wxEXEC_MAKE_GROUP_LEADER); if (m_nConsolePid <= 0) { return -1; } // Issue the PS command to get the /dev/tty device name // First, wait for the xterm to settle down, else PS won't see the sleep task wxSleep(1); m_ConsoleTty = GetConsoleTty(m_nConsolePid); if (m_ConsoleTty.IsEmpty()) { FreeConsole(); return -1; } return m_nConsolePid; #else //__WXMSW__ wxUnusedVar(title); return -1; #endif }
logical DLInterpreter :: ExecuteCommands ( ) { char procname[ID_SIZE+2]; char *name; logical term = NO; // if ( echo ) ShowCurrentLine(); if ( name = current_node->GetAutoRun() ) { memset(procname,0,sizeof(procname)); procname[0] = '@'; strncpy(procname+1,name,ID_SIZE); RunBatch(procname); top_cmdline = this; } run_option = NO; while ( GetConsoleCommand() ) if ( *GetCommand() ) if ( ExecuteCommand() || run_option ) break; return(term); }