-/* $OpenBSD: tty_pty.c,v 1.79 2017/02/11 19:51:06 guenther Exp $ */
+/* $OpenBSD: tty_pty.c,v 1.80 2017/07/04 17:29:51 tedu Exp $ */
/* $NetBSD: tty_pty.c,v 1.33.4.1 1996/06/02 09:08:11 mrg Exp $ */
/*
tp->t_cflag = TTYDEF_CFLAG;
tp->t_ispeed = tp->t_ospeed = B115200;
ttsetwater(tp); /* would be done in xxparam() */
- } else if (tp->t_state&TS_XCLUDE && suser(p, 0) != 0)
+ } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0)
return (EBUSY);
if (tp->t_oproc) /* Ctrlr still around. */
tp->t_state |= TS_CARR_ON;
while ((tp->t_state & TS_CARR_ON) == 0) {
tp->t_state |= TS_WOPEN;
- if (flag&FNONBLOCK)
+ if (flag & FNONBLOCK)
break;
error = ttysleep(tp, &tp->t_rawq, TTIPRI | PCATCH,
ttopen, 0);
* then return the appropriate error instead.
*/
for (;;) {
- if (tp->t_state&TS_ISOPEN) {
- if (pti->pt_flags&PF_PKT && pti->pt_send) {
+ if (tp->t_state & TS_ISOPEN) {
+ if (pti->pt_flags & PF_PKT && pti->pt_send) {
error = ureadc((int)pti->pt_send, uio);
if (error)
return (error);
pti->pt_send = 0;
return (0);
}
- if (pti->pt_flags&PF_UCNTL && pti->pt_ucntl) {
+ if (pti->pt_flags & PF_UCNTL && pti->pt_ucntl) {
error = ureadc((int)pti->pt_ucntl, uio);
if (error)
return (error);
pti->pt_ucntl = 0;
return (0);
}
- if (tp->t_outq.c_cc && (tp->t_state&TS_TTSTOP) == 0)
+ if (tp->t_outq.c_cc && (tp->t_state & TS_TTSTOP) == 0)
break;
}
- if ((tp->t_state&TS_CARR_ON) == 0)
+ if ((tp->t_state & TS_CARR_ON) == 0)
return (0); /* EOF */
if (flag & IO_NDELAY)
return (EWOULDBLOCK);
int error = 0;
again:
- if ((tp->t_state&TS_ISOPEN) == 0)
+ if ((tp->t_state & TS_ISOPEN) == 0)
goto block;
if (pti->pt_flags & PF_REMOTE) {
if (tp->t_canq.c_cc)
if (error)
goto done;
/* check again for safety */
- if ((tp->t_state&TS_ISOPEN) == 0) {
+ if ((tp->t_state & TS_ISOPEN) == 0) {
error = EIO;
goto done;
}
if (error)
goto done;
/* check again for safety */
- if ((tp->t_state&TS_ISOPEN) == 0) {
+ if ((tp->t_state & TS_ISOPEN) == 0) {
error = EIO;
goto done;
}
* Come here to wait for slave to open, for space
* in outq, or space in rawq.
*/
- if ((tp->t_state&TS_CARR_ON) == 0) {
+ if ((tp->t_state & TS_CARR_ON) == 0) {
error = EIO;
goto done;
}
if (*(unsigned int *)data >= NSIG ||
*(unsigned int *)data == 0)
return(EINVAL);
- if ((tp->t_lflag&NOFLSH) == 0)
+ if ((tp->t_lflag & NOFLSH) == 0)
ttyflush(tp, FREAD|FWRITE);
pgsignal(tp->t_pgrp, *(unsigned int *)data, 1);
if ((*(unsigned int *)data == SIGINFO) &&
- ((tp->t_lflag&NOKERNINFO) == 0))
+ ((tp->t_lflag & NOKERNINFO) == 0))
ttyinfo(tp);
return (0);
/*
* If external processing and packet mode send ioctl packet.
*/
- if ((tp->t_lflag&EXTPROC) && (pti->pt_flags & PF_PKT)) {
+ if ((tp->t_lflag & EXTPROC) && (pti->pt_flags & PF_PKT)) {
switch (cmd) {
case TIOCSETA:
case TIOCSETAW: