1: #ifndef lint
   2: static char sccsid[] = "@(#)wwtty.c	3.9 4/24/85";
   3: #endif
   4: 
   5: /*
   6:  * Copyright (c) 1983 Regents of the University of California,
   7:  * All rights reserved.  Redistribution permitted subject to
   8:  * the terms of the Berkeley Software License Agreement.
   9:  */
  10: 
  11: #include "ww.h"
  12: #include <fcntl.h>
  13: 
  14: wwgettty(d, t)
  15: register struct ww_tty *t;
  16: {
  17:     if (ioctl(d, (int)TIOCGETP, (char *)&t->ww_sgttyb) < 0)
  18:         goto bad;
  19:     if (ioctl(d, (int)TIOCGETC, (char *)&t->ww_tchars) < 0)
  20:         goto bad;
  21:     if (ioctl(d, (int)TIOCGLTC, (char *)&t->ww_ltchars) < 0)
  22:         goto bad;
  23:     if (ioctl(d, (int)TIOCLGET, (char *)&t->ww_lmode) < 0)
  24:         goto bad;
  25:     if (ioctl(d, (int)TIOCGETD, (char *)&t->ww_ldisc) < 0)
  26:         goto bad;
  27:     if ((t->ww_fflags = fcntl(d, F_GETFL, 0)) < 0)
  28:         goto bad;
  29:     return 0;
  30: bad:
  31:     wwerrno = WWE_SYS;
  32:     return -1;
  33: }
  34: 
  35: /*
  36:  * Set the modes of tty 'd' to 't'
  37:  * 'o' is the current modes.  We set the line discipline only if
  38:  * it changes, to avoid unnecessary flushing of typeahead.
  39:  */
  40: wwsettty(d, t, o)
  41: register struct ww_tty *t, *o;
  42: {
  43:     if (ioctl(d, (int)TIOCSETN, (char *)&t->ww_sgttyb) < 0)
  44:         goto bad;
  45:     if (ioctl(d, (int)TIOCSETC, (char *)&t->ww_tchars) < 0)
  46:         goto bad;
  47:     if (ioctl(d, (int)TIOCSLTC, (char *)&t->ww_ltchars) < 0)
  48:         goto bad;
  49:     if (ioctl(d, (int)TIOCLSET, (char *)&t->ww_lmode) < 0)
  50:         goto bad;
  51:     if ((o == 0 || t->ww_ldisc != o->ww_ldisc) &&
  52:         ioctl(d, (int)TIOCSETD, (char *)&t->ww_ldisc) < 0)
  53:         goto bad;
  54:     if (fcntl(d, F_SETFL, t->ww_fflags) < 0)
  55:         goto bad;
  56:     return 0;
  57: bad:
  58:     wwerrno = WWE_SYS;
  59:     return -1;
  60: }

Defined functions

wwgettty defined in line 14; used 1 times

Defined variables

sccsid defined in line 2; never used
Last modified: 1985-04-25
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 974
Valid CSS Valid XHTML 1.0 Strict