void SQPSmoother() { Thread* start = new Thread(*glThreads[planThread]->getThread()); Thread* end = new Thread(*glThreads[endThread]->getThread()); vector<Thread*> traj; vector<vector<VectorXd> > mot; DimensionReductionBestPath(start, end, 0, traj, mot); initialized = false; // set to false to prevent visualizer from segfault vector<VectorXd> U; vector<Thread*> smoothTraj; vector<Thread*> downSampledTraj; for (int i = 0; i < traj.size(); i++) { if ( i % 5 == 0) { VectorXd ctrl(12); ctrl.setZero(); U.push_back(ctrl); smoothTraj.push_back(new Thread(*traj[i])); downSampledTraj.push_back(new Thread(*traj[i])); } } int numGoalCopies = smoothTraj.size() / 50; if (numGoalCopies == 0) numGoalCopies = 1; for (int i = 0; i < numGoalCopies; i++) { smoothTraj.push_back(new Thread(*end)); VectorXd ctrl(12); ctrl.setZero(); U.push_back(ctrl); } Iterative_Control* ic = new Iterative_Control(smoothTraj.size(), smoothTraj.front()->num_pieces()); int num_iters = 2; ic->iterative_control_opt(smoothTraj, U, num_iters); vector<vector<VectorXd> > thread_control_data; for (int i = 0; i < smoothTraj.size(); i++) { //vector<Thread*> tmp; //tmp.push_back(traj[i]); //thread_visualization_data.push_back(tmp); vector<VectorXd> motion_wrapper; motion_wrapper.push_back(U[i]); thread_control_data.push_back(motion_wrapper); } Trajectory_Follower *pathFollower = new Trajectory_Follower(smoothTraj, thread_control_data, new Thread(*start)); pathFollower->control_to_finish(); vector<Thread*> control_traj; pathFollower->getReachedStates(control_traj); vector<vector<Thread*> > thread_visualization_data; thread_visualization_data.push_back(downSampledTraj); thread_visualization_data.push_back(smoothTraj); thread_visualization_data.push_back(control_traj); setThreads(thread_visualization_data); }
void avatar::putch(int ch) { if (dispfunc) (this->*dispfunc)(ch); else { switch (ch) { case ctrl('L'): // cls flushbuf(); vs.gotoxy(0, 0); vs.setattr(AVT_DEFAULT); vs.cls(); insertmode = 0; break; case ctrl('Y'): // repeat chr flushbuf(); dispfunc = &avatar::rptchar; counter = -1; break; case ctrl('V'): // Video flushbuf(); dispfunc = &avatar::setvideo; break; default: scrinterp::putch(ch); break; } } }
void drawscrollbar(int top, int bot) { int p1, p2; if (emacsviterm == YES) { if (bot > top) { p1 = 16 + (top - 1) * 100 / totallines; p2 = 16 + (bot - 1) * 100 / totallines; if (p2 > 116) { p2 = 116; } if (p1 < 16) { p1 = 16; } /* don't send ^S or ^Q because it will hang a layer using cu(1) */ if (p1 == ctrl('Q') || p1 == ctrl('S')) { ++p1; } if (p2 == ctrl('Q') || p2 == ctrl('S')) { ++p2; } } else { p1 = p2 = 16; } (void) printf("\033W%c%c", p1, p2); } }
void LineEditor::mouseMoveEvent(QMouseEvent *event) { if (mState == LINE_NEW_FIRST || mState == LINE_NEW_SECOND || mState == VTX_MOVE_START || mState == VTX_MOVE_END || mState == PICK_REF || mState == LINE_MOVE) { mPos = ctrl()->snapToPlaceGrid( ctrl()->view()->transform().inverted() .map(event->pos())); switch(mState) { case VTX_MOVE_START: mLine->setStart(mPos); break; case LINE_NEW_SECOND: case VTX_MOVE_END: mLine->setEnd(mPos); break; default: break; } emit overlayChanged(); } }
void editall(void) { char file[PATHLEN + 1]; /* file name */ char linenum[NUMLEN + 1]; /* line number */ int c; /* verify that there is a references found file */ if (refsfound == NULL) { return; } /* get the first line */ seekline(1); /* get each file name and line number */ while (fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s%*[^\n]", file, linenum) == 2) { edit(file, linenum); /* edit it */ if (editallprompt == YES) { addstr("Type ^D to stop editing all lines, or any other character to continue: "); if ((c = mygetch()) == EOF || c == ctrl('D') || c == ctrl('Z')) { break; } } } seekline(topline); }
void drawscrollbar(int top, int bot, int total) { int p1, p2; if (mouse == EMACSTERM) { if (bot > top && total > 0) { p1 = 16 + (top - 1) * 100 / total; p2 = 16 + (bot - 1) * 100 / total; if (p2 > 116) { p2 = 116; } if (p1 < 16) { p1 = 16; } /* * don't send ^S or ^Q to avoid hanging a layer using * cu(1) */ if (p1 == ctrl('Q') || p1 == ctrl('S')) { ++p1; } if (p2 == ctrl('Q') || p2 == ctrl('S')) { ++p2; } } else { p1 = p2 = 16; } (void) printf("\033W%c%c", p1, p2); } }
MOUSEEVENT * getmouseevent(void) { static MOUSEEVENT m; if (mouse == EMACSTERM) { switch (mygetch()) { case ctrl('_'): /* click */ if ((m.button = mygetch()) == '0') { /* if scroll bar */ m.percent = getpercent(); } else { m.x1 = getcoordinate(); m.y1 = getcoordinate(); m.x2 = m.y2 = -1; } break; case ctrl(']'): /* sweep */ m.button = mygetch(); m.x1 = getcoordinate(); m.y1 = getcoordinate(); m.x2 = getcoordinate(); m.y2 = getcoordinate(); break; default: return (NULL); } return (&m); } return (NULL); }
void LineEditor::mousePressEvent(QMouseEvent *event) { if (mState == SELECTED || mState == VTX_SEL_START || mState == VTX_SEL_END) { // check if a vertex was hit QPoint start = ctrl()->view()->transform().map(mLine->start()); QPoint end = ctrl()->view()->transform().map(mLine->end()); if ((start - event->pos()).manhattanLength() <= 20 || (end - event->pos()).manhattanLength() <= 20 ) event->accept(); else if (mState != SELECTED) { QPoint pos = ctrl()->view()->transform().inverted().map(event->pos()); if (mLine->testHit(pos, ctrl()->hitRadius(), mLine->layer())) event->accept(); else event->ignore(); } else event->ignore(); } else event->ignore(); }
void private_thread::run() { auto job = const_cast<scheduled_actor*>(self_); CAF_PUSH_AID(job->id()); CAF_LOG_TRACE(""); scoped_execution_unit ctx{&job->system()}; auto max_throughput = std::numeric_limits<size_t>::max(); bool resume_later; for (;;) { state_ = await_resume_or_shutdown; do { resume_later = false; switch (job->resume(&ctx, max_throughput)) { case resumable::resume_later: resume_later = true; break; case resumable::done: intrusive_ptr_release(job->ctrl()); return; case resumable::awaiting_message: intrusive_ptr_release(job->ctrl()); break; case resumable::shutdown_execution_unit: return; } } while (resume_later); // wait until actor becomes ready again or was destroyed if (!await_resume()) return; } }
void VHDDExplorer::OnExport(wxCommandEvent& event) { if(m_list->GetSelectedItemCount() > 1) { wxDirDialog ctrl(this, "Select export folder", wxGetCwd()); if(ctrl.ShowModal() == wxID_CANCEL) { return; } for(int sel = m_list->GetNextSelected(-1); sel != wxNOT_FOUND; sel = m_list->GetNextSelected(sel)) { Export(m_names[sel], fmt::ToUTF8(ctrl.GetPath()) + '\\' + m_names[sel]); } } else { int sel = m_list->GetFirstSelected(); wxFileDialog ctrl(this, "Select export file", wxEmptyString, fmt::FromUTF8(m_names[sel]), wxFileSelectorDefaultWildcardStr, wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if(ctrl.ShowModal() == wxID_CANCEL) { return; } Export(m_names[sel], fmt::ToUTF8(ctrl.GetPath())); } UpdateList(); }
int main() { int argc, i; char *argv[16]; char prompt[] = "args> "; char cmdline[128], c, *cl, **ap; oskit_clientos_init(); printf("%s", prompt); for (i = 0; i < sizeof cmdline - 1; i++) { c = getchar(); switch (c) { case '\b': case '\?': if (i > 0) { printf("\b \b"); i--; } i--; continue; case ctrl('U'): while (i > 0) { printf("\b \b"); i--; } i--; continue; case ctrl('R'): cmdline[i] = 0; printf("^R\n%s%s", prompt, cmdline); i--; continue; case '\n': case ctrl('M'): putchar('\n'); break; default: cmdline[i] = c; putchar(c); continue; } break; } cmdline[i] = 0; cl = cmdline; argv[0] = "memtest"; argc = 1; for (ap = &argv[1]; (*ap = strsep(&cl, " \t")) != 0; ) if (**ap) { ap++; if (++argc == sizeof(argv)/sizeof(argv[0])) break; } return real_main(argc, argv); }
int HKVisualParameter::Read_XML_VisualFeatures( AST_TXML_Tag *root, AST_TXML_Attribute *page_title, AST_TXML_Attribute *control, DRMessageManager& dmm, long dmm_page ) { if( page_title ) { if( page_title->getValueType() == ASTVALT_TXML_Int ) setPropertyPageNo( page_title->getIntValue() ); else if( page_title->getValueType() == ASTVALT_TXML_String ) setPropertyPageTitle( page_title->getStringValue() ); } if( control && control->getValueType() == ASTVALT_TXML_String ) { if( !xml_strcmp( control->getStringValue(), FBL_VAL_color_combo_box ) ) { GUICtrlTemplate ctrl( GUI_CTRL_TEMPLATE_COLOR_COMBO_BOX, getType() ); setGUICtrl( ctrl ); } else if( !xml_strcmp( control->getStringValue(), FBL_VAL_edit_box ) ) { GUICtrlTemplate ctrl( GUI_CTRL_TEMPLATE_EDIT_BOX, getType() ); setGUICtrl( ctrl ); } else if( !xml_strcmp( control->getStringValue(), FBL_VAL_open_file_edit_box ) ) { GUICtrlTemplate ctrl( GUI_CTRL_TEMPLATE_OPEN_FILE_EDIT_BOX, getType() ); setGUICtrl( ctrl ); } else if( !xml_strcmp( control->getStringValue(), FBL_VAL_formulator_edit_box ) ) { GUICtrlTemplate ctrl( GUI_CTRL_TEMPLATE_FORMULATOR_EDIT_BOX, getType() ); setGUICtrl( ctrl ); } else if( !xml_strcmp( control->getStringValue(), FBL_VAL_dropdown_combo_box ) ) { GUICtrlTemplate ctrl( GUI_CTRL_TEMPLATE_DROPDOWN_COMBO_BOX, getType() ); setGUICtrl( ctrl ); QString warn2 = _T("property control (dropdown combo box) is empty"); dmm.AddLine( dmm_page, warn2, root->getLine() ); } else { QString warn1 = _T("property control name field %1 is unknown"); dmm.AddLine( dmm_page, warn1, root->getLine(), control->getStringValue() ); } } else Read_XML_ControlTag( root, dmm, dmm_page ); return 0; }
/* * Help command */ void help(char c) { esctable_t *p; (void)printf("%c\r\n", c); for (p = etable; p->e_char; p++) { if ((p->e_flags&PRIV) && uid) continue; (void)printf("%2s", ctrl(character(value(ESCAPE)))); (void)printf("%-2s %c %s\r\n", ctrl(p->e_char), p->e_flags&EXP ? '*': ' ', p->e_help); } }
void MainFrame::InstallPkg(wxCommandEvent& WXUNUSED(event)) { bool stopped = false; if(Emu.IsRunning()) { Emu.Pause(); stopped = true; } wxFileDialog ctrl(this, L"Select PKG", wxEmptyString, wxEmptyString, "PKG files (*.pkg)|*.pkg|All files (*.*)|*.*", wxFD_OPEN | wxFD_FILE_MUST_EXIST); if(ctrl.ShowModal() == wxID_CANCEL) { if(stopped) Emu.Resume(); return; } Emu.Stop(); // Open and install PKG file fs::file pkg_f(ctrl.GetPath().ToStdString(), fom::read); if (pkg_f) { Emu.GetVFS().Init("/"); std::string local_path; Emu.GetVFS().GetDevice("/dev_hdd0/game/", local_path); PKGLoader::Install(pkg_f, local_path + "/"); // Refresh game list m_game_viewer->Refresh(); } }
void MainFrame::BootGame(wxCommandEvent& WXUNUSED(event)) { bool stopped = false; if(Emu.IsRunning()) { Emu.Pause(); stopped = true; } wxDirDialog ctrl(this, L"Select game folder", wxEmptyString); if(ctrl.ShowModal() == wxID_CANCEL) { if(stopped) Emu.Resume(); return; } Emu.Stop(); if(Emu.BootGame(ctrl.GetPath().ToStdString())) { LOG_SUCCESS(HLE, "Game: boot done."); if (Ini.HLEAlwaysStart.GetValue() && Emu.IsReady()) { Emu.Run(); } } else { LOG_ERROR(HLE, "PS3 executable not found in selected folder (%s)", fmt::ToUTF8(ctrl.GetPath())); // passing std::string (test) } }
void MainFrame::InstallPkg(wxCommandEvent& WXUNUSED(event)) { bool stopped = false; if(Emu.IsRunning()) { Emu.Pause(); stopped = true; } wxFileDialog ctrl (this, L"Select PKG", wxEmptyString, wxEmptyString, "PKG files (*.pkg)|*.pkg|All files (*.*)|*.*", wxFD_OPEN | wxFD_FILE_MUST_EXIST); if(ctrl.ShowModal() == wxID_CANCEL) { if(stopped) Emu.Resume(); return; } Emu.Stop(); // Open and install PKG file std::string filePath = ctrl.GetPath().ToStdString(); rFile pkg_f(filePath, rFile::read); // TODO: Use VFS to install PKG files if (pkg_f.IsOpened()) { PKGLoader pkg(pkg_f); pkg.Install("/dev_hdd0/game/"); pkg.Close(); // Refresh game list m_game_viewer->Refresh(); } }
/* * FTP - send single character * wait for echo & handle timeout */ static void send(char c) { char cc; int retry = 0; cc = c; xpwrite(FD, &cc, 1); if (number(value(CDELAY)) > 0 && c != '\r') nap(number(value(CDELAY))); if (!boolean(value(ECHOCHECK))) { if (number(value(LDELAY)) > 0 && c == '\r') nap(number(value(LDELAY))); return; } tryagain: timedout = 0; alarm(number(value(ETIMEOUT))); read(FD, &cc, 1); alarm(0); if (timedout) { printf("\r\ntimeout error (%s)\r\n", ctrl(c)); if (retry++ > 3) return; xpwrite(FD, &null, 1); /* poke it */ goto tryagain; } }
bool ClingoPropagator::init(Solver& s) { POTASSCO_REQUIRE(s.decisionLevel() == 0 && prop_ == trail_.size(), "Invalid init"); Control ctrl(*this, s, state_init); init_ = call_->init(init_, ctrl); front_ = call_->checkMode() == ClingoPropagatorCheck_t::Fixpoint ? -1 : INT32_MAX; return true; }
void Progress::Dialog::OnSetRange () { if (_dlgHandle.IsNull ()) { // Create progress meter dialog if (_parentWin.IsNull ()) { // Showing progress meter on the desktop -- don't delay // progress meter dialog display _dlgData.SetInitialDelay (0); } std::auto_ptr<::Dialog::ModelessController> ctrl (new Progress::DialogController (*GetControlHandler (), _msgPrepro, _dlgId)); ::Dialog::ModelessMaker progressMeter (*GetControlHandler (), ctrl); ::Dialog::Template dlgTemplate; CreateDialogTemplate (dlgTemplate); _dlgHandle = progressMeter.Create (_parentWin, dlgTemplate); } else { // Progress meter dialog already created Progress::CtrlHandler * ctrlHandler = GetControlHandler (); if (ctrlHandler != 0) ctrlHandler->Refresh (); } }
void G1StaticIHOPControl::test() { size_t const initial_ihop = 45; G1StaticIHOPControl ctrl(initial_ihop); ctrl.update_target_occupancy(100); size_t threshold = ctrl.get_conc_mark_start_threshold(); assert(threshold == initial_ihop, "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold); ctrl.update_allocation_info(100.0, 100, 100); threshold = ctrl.get_conc_mark_start_threshold(); assert(threshold == initial_ihop, "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold); ctrl.update_marking_length(1000.0); threshold = ctrl.get_conc_mark_start_threshold(); assert(threshold == initial_ihop, "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold); // Whatever we pass, the IHOP value must stay the same. test_update(&ctrl, 2, 10, 10, 3); threshold = ctrl.get_conc_mark_start_threshold(); assert(threshold == initial_ihop, "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold); test_update(&ctrl, 12, 10, 10, 3); threshold = ctrl.get_conc_mark_start_threshold(); assert(threshold == initial_ihop, "Expected IHOP threshold of " SIZE_FORMAT " but is " SIZE_FORMAT, initial_ihop, threshold); }
void MainFrame::BootSelf(wxCommandEvent& WXUNUSED(event)) { bool stoped = false; if(Emu.IsRunned()) { Emu.Pause(); stoped = true; } wxFileDialog ctrl(this, L"Select SELF", wxEmptyString, wxEmptyString, "*.*", wxFD_OPEN | wxFD_FILE_MUST_EXIST); if(ctrl.ShowModal() == wxID_CANCEL) { if(stoped) Emu.Resume(); return; } ConLog.Write("SELF: booting..."); Emu.Stop(); Emu.SetSelf(ctrl.GetPath()); Emu.Load(); ConLog.Write("SELF: boot done."); }
void MainFrame::BootElf(wxCommandEvent& WXUNUSED(event)) { bool stopped = false; if(Emu.IsRunning()) { Emu.Pause(); stopped = true; } wxFileDialog ctrl(this, L"Select (S)ELF", wxEmptyString, wxEmptyString, "(S)ELF files (*BOOT.BIN;*.elf;*.self)|*BOOT.BIN;*.elf;*.self" "|ELF files (BOOT.BIN;*.elf)|BOOT.BIN;*.elf" "|SELF files (EBOOT.BIN;*.self)|EBOOT.BIN;*.self" "|BOOT files (*BOOT.BIN)|*BOOT.BIN" "|BIN files (*.bin)|*.bin" "|All files (*.*)|*.*", wxFD_OPEN | wxFD_FILE_MUST_EXIST); if(ctrl.ShowModal() == wxID_CANCEL) { if(stopped) Emu.Resume(); return; } LOG_NOTICE(LOADER, "(S)ELF: booting..."); Emu.Stop(); Emu.SetPath(fmt::ToUTF8(ctrl.GetPath())); Emu.Load(); LOG_SUCCESS(LOADER, "(S)ELF: boot done."); }
void MainFrame::BootGame(wxCommandEvent& WXUNUSED(event)) { bool stopped = false; if(Emu.IsRunning()) { Emu.Pause(); stopped = true; } wxDirDialog ctrl(this, L"Select game folder", wxEmptyString); if(ctrl.ShowModal() == wxID_CANCEL) { if(stopped) Emu.Resume(); return; } Emu.Stop(); if(!Emu.BootGame(ctrl.GetPath().ToStdString())) { LOG_ERROR(GENERAL, "PS3 executable not found in selected folder (%s)", fmt::ToUTF8(ctrl.GetPath())); // passing std::string (test) } }
void MainFrame::BootGameAndRun(wxCommandEvent& WXUNUSED(event)) { bool stopped = false; if (Emu.IsRunning()) { Emu.Pause(); stopped = true; } wxDirDialog ctrl(this, L"Select game folder", wxEmptyString); if (ctrl.ShowModal() == wxID_CANCEL) { if (stopped) Emu.Resume(); return; } Emu.Stop(); if (Emu.BootGame(ctrl.GetPath().ToStdString())) { ConLog.Success("Game: boot done."); } else { ConLog.Error("PS3 executable not found in selected folder (%s)", ctrl.GetPath().wx_str()); } if (Emu.IsReady()) { Emu.Run(); } }
void loop(){ boost::shared_ptr<Pacer::Controller> ctrl(ctrl_weak_ptr); Ravelin::VectorNd generalized_fext = ctrl->get_generalized_value(Pacer::Robot::load); // Unstable simulation. if(generalized_fext.norm() > 1e8) throw std::runtime_error("Robot exploded!"); // Fell off edge Ravelin::Vector3d x; ctrl->get_data<Ravelin::Vector3d>("base.state.x",x); if(x[2] < -1.0) throw std::runtime_error("Robot fell!"); boost::shared_ptr<Ravelin::Pose3d> base_link_frame(new Ravelin::Pose3d(ctrl->get_data<Ravelin::Pose3d>("base_link_frame"))); Ravelin::Vector3d up(0,0,1,base_link_frame); up = Ravelin::Pose3d::transform_vector(Pacer::GLOBAL,up); if(up[2] < 0) throw std::runtime_error("Robot flipped over!"); std::vector< boost::shared_ptr< const Pacer::Robot::contact_t> > c; ctrl->get_link_contacts("BODY0",c); if(c.size() != 0) throw std::runtime_error("Robot body contacted ground!"); }
/* * Escape handler -- * called on recognition of ``escapec'' at the beginning of a line */ char escape(void) { char gch; esctable_t *p; char c = character(value(ESCAPE)); int i; i = getchar(); if (i == EOF) return 0; gch = (i&0177); for (p = etable; p->e_char; p++) if (p->e_char == gch) { if ((p->e_flags&PRIV) && uid) continue; printf("%s", ctrl(c)); (*p->e_func)(gch); return (0); } /* ESCAPE ESCAPE forces ESCAPE */ if (c != gch) xpwrite(FD, &c, 1); return (gch); }
DataGen::DataGen(ulen n) : qset(DoReserve,1000) { // make qset SmallPrimesSet spset(n); do { PrimeQ q(spset); if( q.test() ) qset.append_copy(q); } while( spset.next() ); qset.shrink_extra(); Sort(Range(qset)); // make pset for(ulen ind=0; ind<=n ;ind++) pset.append_fill(ind); // make Jacobi { for(ulen j=0,len=qset.getLen(); j<len ;j++) { JobControl ctrl(qset[j],Range(pset)); Job run_job(ctrl.function_job()); } } }
void LineEditor::actionEdit() { PCBObjState prev = mLine->getState(); if (!mDialog) mDialog = QSharedPointer<EditLineDialog>(new EditLineDialog(ctrl()->view())); mDialog->init(mLine); if (mDialog->exec() == QDialog::Rejected) return; mWidth = mDialog->width(); mLayer = mDialog->layer(); mLine->setWidth(mWidth); mLine->setLayer(mLayer); QUndoCommand* cmd = new PCBObjEditCmd(NULL, mLine, prev); ctrl()->doc()->doCommand(cmd); emit overlayChanged(); }
void VHDDManagerDialog::AddHDD(wxCommandEvent& event) { wxFileDialog ctrl(this, "Select HDDs", wxEmptyString, wxEmptyString, "Virtual HDD (*.hdd) | *.hdd", wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE); if(ctrl.ShowModal() == wxID_CANCEL) { return; } wxArrayString paths; ctrl.GetPaths(paths); for(size_t i=0; i<paths.GetCount(); ++i) { bool skip = false; for(size_t j=0; j<m_paths.size(); ++j) { if(fmt::FromUTF8(m_paths[j]).CmpNoCase(paths[i]) == 0) { skip = true; break; } } if(!skip) { m_paths.emplace_back(fmt::ToUTF8(paths[i])); } } UpdateList(); }
/* * FTP - send single character * wait for echo & handle timeout */ void send(char c) { char cc; int retry = 0; cc = c; parwrite(FD, (unsigned char *)&cc, 1); #ifdef notdef if (number(value(CDELAY)) > 0 && c != '\r') nap(number(value(CDELAY))); #endif if (!boolean(value(ECHOCHECK))) { #ifdef notdef if (number(value(LDELAY)) > 0 && c == '\r') nap(number(value(LDELAY))); #endif return; } tryagain: timedout = 0; if (sigsetjmp(intbuf, 1) && timedout) { (void) printf("\r\ntimeout error (%s)\r\n", ctrl(c)); if (retry++ > 3) return; parwrite(FD, (unsigned char *)&null, 1); /* poke it */ goto tryagain; } (void) alarm(number(value(ETIMEOUT))); (void) read(FD, &cc, 1); (void) alarm(0); }