1 /* $OpenBSD: hack.ioctl.c,v 1.3 2001/08/06 22:59:13 pjanzen Exp $ */ 2 3 /* 4 * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. 5 */ 6 7 #ifndef lint 8 static char rcsid[] = "$OpenBSD: hack.ioctl.c,v 1.3 2001/08/06 22:59:13 pjanzen Exp $"; 9 #endif /* not lint */ 10 11 /* This cannot be part of hack.tty.c (as it was earlier) since on some 12 systems (e.g. MUNIX) the include files <termio.h> and <sgtty.h> 13 define the same constants, and the C preprocessor complains. */ 14 #include <stdio.h> 15 #include <termios.h> 16 #include "config.h" 17 struct termios termios; 18 19 getioctls() { 20 (void) tcgetattr(fileno(stdin), &termios); 21 } 22 23 setioctls() { 24 (void) tcsetattr(fileno(stdin), TCSADRAIN, &termios); 25 } 26 27 #ifdef SUSPEND /* implies BSD */ 28 #include <signal.h> 29 dosuspend() { 30 #ifdef SIGTSTP 31 if(signal(SIGTSTP, SIG_IGN) == SIG_DFL) { 32 settty((char *) 0); 33 (void) signal(SIGTSTP, SIG_DFL); 34 (void) 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