home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d189 / nethack.lha / NetHack / eenaux.zoo / aux / ioctl.c < prev    next >
C/C++ Source or Header  |  1988-07-01  |  1KB  |  55 lines

  1. /*    SCCS Id: @(#)ioctl.c    2.0    87/09/18
  2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  3.  
  4. /* This cannot be part of hack.tty.c (as it was earlier) since on some
  5.    systems (e.g. MUNIX) the include files <termio.h> and <sgtty.h>
  6.    define the same constants, and the C preprocessor complains. */
  7. #include <stdio.h>
  8. #include "config.h"
  9. #ifdef BSD
  10. #include    <sgtty.h>
  11. struct ltchars ltchars, ltchars0;
  12. #else
  13. #include    <termio.h>      /* also includes part of <sgtty.h> */
  14. struct termio termio;
  15. #endif
  16.  
  17. getioctls() {
  18. #ifdef BSD
  19.     (void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) <chars);
  20.     (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars0);
  21. #else
  22.     (void) ioctl(fileno(stdin), (int) TCGETA, &termio);
  23. #endif
  24. }
  25.  
  26. setioctls() {
  27. #ifdef BSD
  28.     (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars);
  29. #else
  30.     /* Now modified to run under Sys V R3.    - may have to be #ifdef'ed */
  31.     (void) ioctl(fileno(stdin), (int) TCSETAW, &termio);
  32. #endif
  33. }
  34.  
  35. #ifdef SUSPEND          /* implies BSD */
  36. dosuspend() {
  37. #include    <signal.h>
  38. #ifdef SIGTSTP
  39.     if(signal(SIGTSTP, SIG_IGN) == SIG_DFL) {
  40.     settty((char *) 0);
  41.     (void) signal(SIGTSTP, SIG_DFL);
  42.     (void) kill(0, SIGTSTP);
  43.     gettty();
  44.     setftty();
  45.     docrt();
  46.     } else {
  47.     pline("I don't think your shell has job control.");
  48.     }
  49. #else SIGTSTP
  50.     pline("Sorry, it seems we have no SIGTSTP here. Try ! or S.");
  51. #endif
  52.     return(0);
  53. }
  54. #endif /* SUSPEND /**/
  55.