Lines Matching defs:fd

158  * This routine returns true if fd refers to a terminal
161 int tty_check(int fd)
166 return(tty_get(fd,&tty)==0);
175 int tty_get(register int fd, register struct termios *tty)
178 if(fd == ep->e_savefd)
182 while(tcgetattr(fd,tty) == SYSERR)
192 ep->e_savefd = fd;
200 * If fd<0, then current attributes are invalidated
203 int tty_set(int fd, int action, struct termios *tty)
206 if(fd >=0)
212 while(tcsetattr(fd, action, tty) == SYSERR)
220 ep->e_savefd = fd;
225 /*{ TTY_COOKED( fd )
232 void tty_cooked(register int fd)
237 if(fd < 0)
238 fd = ep->e_savefd;
242 ioctl(fd,TIOCLSET,&l_mask);
245 ioctl(fd,TIOCSETC,&l_ttychars);
248 ioctl(fd,TIOCSLTC,&l_chars);
252 if(tty_set(fd, TCSANOW, &ttyparm) == SYSERR)
258 /*{ TTY_RAW( fd )
264 int tty_raw(register int fd, int echomode)
279 if(tty_get(fd,&ttyparm) == SYSERR)
304 if( tty_set(fd, TCSADRAIN, &nttyparm) == SYSERR )
309 if(ioctl(fd,TIOCGLTC,&l_chars) != SYSERR)
315 if(ioctl(fd,TIOCSLTC,&lchars) != SYSERR)
375 if( tty_set(fd, TCSADRAIN, &nttyparm) == SYSERR )
392 int tty_alt(register int fd)
404 tty_cooked(fd);
409 if((tty_get(fd,&ttyparm) != SYSERR))
413 if(ioctl(fd,TIOCGETC,&l_ttychars) == SYSERR)
415 if(ioctl(fd,TIOCLGET,&l_mask)==SYSERR)
421 if(ioctl(fd,TIOCLBIS,&mask)==SYSERR)
427 if(ioctl(fd,TIOCSETC,&ttychars) == SYSERR)
440 int tty_alt(register int fd)
450 tty_cooked(fd);
452 if((tty_get(fd, &ttyparm)==SYSERR) || (!(ttyparm.c_lflag&ECHO)))
498 if( tty_set(fd, TCSADRAIN, &nttyparm) == SYSERR )
541 register int fd = ERRIO;
544 write(fd,ep->e_outbase,(unsigned)n);
588 void ed_setup(register Edit_t *ep, int fd, int reedit)
597 ep->e_fd = fd;
737 if(fd == sffileno(sfstderr))
806 int ed_read(void *context, int fd, char *buff, int size, int reedit)
875 if(!waitevent || (rv=(*waitevent)(fd,-1L,0))>=0)
876 rv = sfpkrd(fd,buff,size,delim,-1L,mode);
887 if((ep->e_tty=ttyname(fd)) && stat(ep->e_tty,&statb)>=0)
893 if(ep->e_tty_ino && fstat(fd,&statb)>=0 && statb.st_ino==ep->e_tty_ino && statb.st_dev==ep->e_tty_dev)
904 rv = read(fd,buff,size);
914 rv = read(fd,buff,rv>0?rv:1);
1490 int tcgetattr(int fd, struct termios *tt)
1496 if((r=ioctl(fd,TCGETS,tt))>=0 || errno!=EINVAL)
1498 if((r=ioctl(fd,TCGETA,&ott)) >= 0)
1512 int tcsetattr(int fd,int mode,struct termios *tt)
1545 return(ioctl(fd,mode,&ott));
1547 return(ioctl(fd,mode,tt));