Commit | Line | Data |
---|---|---|
b94626a3 | 1 | #ifndef lint |
7edc52ec | 2 | static char sccsid[] = "@(#)wwtty.c 3.7 %G%"; |
b94626a3 EW |
3 | #endif |
4 | ||
5 | #include "ww.h" | |
b1189050 | 6 | #include <fcntl.h> |
b94626a3 EW |
7 | |
8 | wwgettty(d, t) | |
9 | register struct ww_tty *t; | |
10 | { | |
91f10fe7 | 11 | if (ioctl(d, (int)TIOCGETP, (char *)&t->ww_sgttyb) < 0) |
03e75950 | 12 | goto bad; |
91f10fe7 | 13 | if (ioctl(d, (int)TIOCGETC, (char *)&t->ww_tchars) < 0) |
03e75950 | 14 | goto bad; |
91f10fe7 | 15 | if (ioctl(d, (int)TIOCGLTC, (char *)&t->ww_ltchars) < 0) |
03e75950 | 16 | goto bad; |
91f10fe7 | 17 | if (ioctl(d, (int)TIOCLGET, (char *)&t->ww_lmode) < 0) |
03e75950 | 18 | goto bad; |
91f10fe7 | 19 | if (ioctl(d, (int)TIOCGETD, (char *)&t->ww_ldisc) < 0) |
03e75950 | 20 | goto bad; |
b1189050 EW |
21 | if ((t->ww_fflags = fcntl(d, F_GETFL, 0)) < 0) |
22 | goto bad; | |
b94626a3 | 23 | return 0; |
03e75950 EW |
24 | bad: |
25 | wwerrno = WWE_SYS; | |
26 | return -1; | |
b94626a3 EW |
27 | } |
28 | ||
29 | wwsettty(d, t) | |
30 | register struct ww_tty *t; | |
31 | { | |
4494450d | 32 | if (ioctl(d, (int)TIOCSETN, (char *)&t->ww_sgttyb) < 0) |
03e75950 | 33 | goto bad; |
91f10fe7 | 34 | if (ioctl(d, (int)TIOCSETC, (char *)&t->ww_tchars) < 0) |
03e75950 | 35 | goto bad; |
91f10fe7 | 36 | if (ioctl(d, (int)TIOCSLTC, (char *)&t->ww_ltchars) < 0) |
03e75950 | 37 | goto bad; |
91f10fe7 | 38 | if (ioctl(d, (int)TIOCLSET, (char *)&t->ww_lmode) < 0) |
03e75950 | 39 | goto bad; |
91f10fe7 | 40 | if (ioctl(d, (int)TIOCSETD, (char *)&t->ww_ldisc) < 0) |
03e75950 | 41 | goto bad; |
b1189050 EW |
42 | if (fcntl(d, F_SETFL, t->ww_fflags) < 0) |
43 | goto bad; | |
b94626a3 | 44 | return 0; |
03e75950 EW |
45 | bad: |
46 | wwerrno = WWE_SYS; | |
47 | return -1; | |
b94626a3 | 48 | } |