- newtt.sg_flags = (newtt.sg_flags | CBREAK) & ~(CRMOD | ECHO);
- if ((newtt.sg_flags & TBDELAY) == XTABS)
- newtt.sg_flags &= ~TBDELAY;
- if (ioctl(0, TIOCSETN, &newtt))
- stop("ioctl(TIOCSETN) fails");
- ospeed = newtt.sg_ospeed;
- omask = sigblock(sigmask(SIGTSTP) | sigmask(SIGTTOU));
+ newtt.c_lflag &= ~(ICANON|ECHO);
+ newtt.c_oflag &= ~OXTABS;
+ if (tcsetattr(0, TCSADRAIN, &newtt) < 0)
+ stop("tcsetattr() fails");
+ ospeed = cfgetospeed(&newtt);
+ (void) sigprocmask(SIG_BLOCK, &sigset, &osigset);