home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / unixlib / !UnixLib / test / c / ttytest < prev    next >
Encoding:
Text File  |  1994-03-08  |  784 b   |  27 lines

  1. /* ttytest.c (c) Copyright 1990 H.Rogers */
  2.  
  3. /* This program tests the terminal I/O control routines. */
  4. /* For full information on termio, read the entry for the terminal
  5.  * device driver in section 4 of the UNIX Programmer's Manual. */
  6.  
  7. #include <stdio.h>        /* standard I/O */
  8.  
  9. #include "termio.h"        /* terminal I/O */
  10. #include "unistd.h"        /* UNIX system calls */
  11.  
  12. int
  13. main ()
  14. {
  15.   struct termio t[1];        /* terminal I/O control structure */
  16.  
  17.   setvbuf (stdout, 0, _IONBF, BUFSIZ);    /* unbuffer stdout */
  18.   ioctl (0, TCGETA, t);        /* get terminal I/O control */
  19.   t->c_lflag &= (~(ICANON | ECHO));
  20.   t->c_cc[VMIN] = 1;
  21.   t->c_cc[VTIME] = 0;
  22.   ioctl (0, TCSETA, t);        /* set terminal I/O control */
  23.   while (-1)
  24.     printf (" %02X ", getchar ());    /* hex dump keyboard input */
  25.   return 0;
  26. }
  27.