1 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 2 /* hack.ioctl.c - version 1.0.2 */ 3 /* $FreeBSD: src/games/hack/hack.ioctl.c,v 1.2 1999/09/12 07:01:23 marcel Exp $ 4 $DragonFly: src/games/hack/hack.ioctl.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ 5 6 This cannot be part of hack.tty.c (as it was earlier) since on some 7 systems (e.g. MUNIX) the include files <termio.h> and <sgtty.h> 8 define the same constants, and the C preprocessor complains. */ 9 #include "hack.h" 10 #include <termios.h> 11 struct termios termio; 12 13 void 14 getioctls(void) 15 { 16 tcgetattr(fileno(stdin), &termio); 17 } 18 19 void 20 setioctls(void) 21 { 22 tcsetattr(fileno(stdin), TCSANOW, &termio); 23 } 24 25 #ifdef SUSPEND 26 #include <signal.h> 27 int 28 dosuspend(void) 29 { 30 #ifdef SIGTSTP 31 if(signal(SIGTSTP, SIG_IGN) == SIG_DFL) { 32 settty(NULL); 33 signal(SIGTSTP, SIG_DFL); 34 kill(0, SIGTSTP); 35 gettty(); 36 setftty(); 37 docrt(); 38 } else { 39 pline("I don't think your shell has job control."); 40 } 41 #else /* SIGTSTP */ 42 pline("Sorry, it seems we have no SIGTSTP here. Try ! or S."); 43 #endif /* SIGTSTP */ 44 return(0); 45 } 46 #endif /* SUSPEND */ 47