home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / HACKSRC.ZIP / IOCTL.C < prev    next >
C/C++ Source or Header  |  1985-10-16  |  1KB  |  60 lines

  1. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  2. /* ioctl.c - version 1.0.2 */
  3.  
  4. /* This cannot be part of 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. #ifndef MSDOS
  10. #ifdef BSD
  11. #include    <sgtty.h>
  12. struct ltchars ltchars, ltchars0;
  13. #else
  14. #include    <termio.h>    /* also includes part of <sgtty.h> */
  15. struct termio termio;
  16. #endif BSD
  17. #endif MSDOS
  18.  
  19. getioctls() {
  20. #ifndef MSDOS
  21. #ifdef BSD
  22.     (void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) <chars);
  23.     (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars0);
  24. #else
  25.     (void) ioctl(fileno(stdin), (int) TCGETA, &termio);
  26. #endif BSD
  27. #endif MSDOS
  28. }
  29.  
  30. setioctls() {
  31. #ifndef MSDOS
  32. #ifdef BSD
  33.     (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars);
  34. #else
  35.     (void) ioctl(fileno(stdin), (int) TCSETA, &termio);
  36. #endif BSD
  37. #endif MSDOS
  38. }
  39.  
  40. #ifdef SUSPEND        /* implies BSD */
  41. dosuspend() {
  42. #include    <signal.h>
  43. #ifdef SIGTSTP
  44.     if(signal(SIGTSTP, SIG_IGN) == SIG_DFL) {
  45.         settty((char *) 0);
  46.         (void) signal(SIGTSTP, SIG_DFL);
  47.         (void) kill(0, SIGTSTP);
  48.         gettty();
  49.         setftty();
  50.         docrt();
  51.     } else {
  52.         pline("I don't think your shell has job control.");
  53.     }
  54. #else SIGTSTP
  55.     pline("Sorry, it seems we have no SIGTSTP here. Try ! or S.");
  56. #endif SIGTSTP
  57.     return(0);
  58. }
  59. #endif SUSPEND
  60.