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