home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / RiscOS / APP / DEVS / FORTH / BEETLE / BEETLE.ZIP / Beetle / noecho.c < prev    next >
C/C++ Source or Header  |  1997-04-22  |  730b  |  38 lines

  1. /* NOECHO.C
  2.  
  3.     Vrsn  Date   Comment
  4.     ----|-------|---------------------------------------------------------------
  5.     0.00 02apr95 Adapted from Martin Richards's code.
  6.  
  7.     Reuben Thomas
  8.  
  9.  
  10.     void init_keyb(void)  initialises the keyboard interface.
  11.     void restore_keyb(void) restores the keyboard to its original state.
  12.  
  13. */
  14.  
  15.  
  16. #define BSD_COMP
  17. #include <stdio.h>
  18. #include <sys/ioctl.h>
  19. #include <sgtty.h>
  20.  
  21.  
  22. void init_keyb(void)
  23. {
  24.     struct sgttyb ttyb;
  25.  
  26.     ioctl(0, TIOCGETP, &ttyb);
  27.     ttyb.sg_flags = CBREAK+EVENP+ODDP+CRMOD;
  28.     ioctl(0, TIOCSETP, &ttyb);
  29. }
  30.  
  31. void restore_keyb(void)
  32. {
  33.     struct sgttyb ttyb;
  34.     ioctl(0, TIOCGETP, &ttyb);
  35.     ttyb.sg_flags = ECHO+EVENP+ODDP+CRMOD;
  36.     ioctl(0, TIOCSETP, &ttyb);
  37. }
  38.