1: /*
   2: #	TTYCTL(3.icon)
   3: #
   4: #	Control of terminal attributes
   5: #
   6: #	Steven B. Wampler
   7: #
   8: #	Last modified 8/19/84
   9: #
  10: */
  11: 
  12: #include "../h/rt.h"
  13: #ifdef VAX
  14: #include <sgtty.h>
  15: #define TIOCQSIZ        (('t'<<8)|65)
  16: 
  17: int oldttyflags = -1234;
  18: 
  19: Xstty(nargs)                                            /* set tty device flags */
  20: int nargs;
  21:    {
  22:    register int oldflags, i, n;
  23:    long l;
  24:    struct sgttyb oldmodes;
  25:    struct descrip arg;
  26: 
  27:    ioctl(2,TIOCGETP,&oldmodes);                         /* old modes */
  28:    oldflags = oldmodes.sg_flags;
  29:    if (oldttyflags == -1234)                            /* save if 1st call */
  30:       oldttyflags = oldflags;
  31: 
  32:    for (n = 1; n <= nargs; n++) {
  33:       arg = ARG(n);
  34:       if (cvint(&arg, &l) == NULL)
  35:          runerr(101, &arg);
  36:       i = (int)l;
  37:       if (l < 0)                                        /* turn off flag */
  38:          oldmodes.sg_flags &= ~-(int)l;
  39:       else                                              /* turn on flag */
  40:          oldmodes.sg_flags |= (int)l;
  41:       }
  42: 
  43:    ioctl(2,TIOCSETP,&oldmodes);                         /* new modes */
  44:    mkint(oldflags, &ARG(0));                            /* return old modes */
  45:    }
  46: 
  47: Procblock(stty,-1)
  48: 
  49: Xrestty(nargs)                                          /* reset tty to original state */
  50: int nargs;
  51:    {                    /* if original state unknown, makes a guess */
  52:    register int oldflags;
  53:    struct sgttyb oldmodes;
  54: 
  55:    ioctl(2,TIOCGETP,&oldmodes);
  56:    oldflags = oldmodes.sg_flags;
  57:    oldmodes.sg_flags = (oldttyflags == -1234) ? 0330 : oldttyflags;
  58:    ioctl(2,TIOCSETP,&oldmodes);
  59:    mkint(oldflags, &ARG(0));                             /* return old modes */
  60:    }
  61: 
  62: Procblock(restty,0)
  63: 
  64: Xkeyin(nargs)
  65: int nargs;
  66:   {
  67:   long count;
  68:   count = 0;
  69:   ioctl(0, FIONREAD, &count);
  70: 
  71:   if (count == 0L)
  72:      fail();
  73: 
  74:   ARG(0) = nulldesc;
  75:   }
  76: 
  77: Procblock(keyin,0)
  78: #endif VAX

Defined functions

Procblock defined in line 62; never used
Xkeyin defined in line 62; never used
Xrestty defined in line 47; never used
Xstty defined in line 19; never used

Defined variables

oldttyflags defined in line 17; used 4 times

Defined macros

TIOCQSIZ defined in line 15; never used
Last modified: 1984-08-19
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 977
Valid CSS Valid XHTML 1.0 Strict