xref: /netbsd-src/games/hack/hack.ioctl.c (revision 76dfffe33547c37f8bdd446e3e4ab0f3c16cea4b)
1 /*
2  * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
3  */
4 
5 #ifndef lint
6 static char rcsid[] = "$NetBSD: hack.ioctl.c,v 1.5 1995/04/28 23:01:45 mycroft Exp $";
7 #endif /* not lint */
8 
9 /* This cannot be part of hack.tty.c (as it was earlier) since on some
10    systems (e.g. MUNIX) the include files <termio.h> and <sgtty.h>
11    define the same constants, and the C preprocessor complains. */
12 #include <stdio.h>
13 #include <termios.h>
14 #include "config.h"
15 struct termios termios;
16 
17 getioctls() {
18 	(void) tcgetattr(fileno(stdin), &termios);
19 }
20 
21 setioctls() {
22 	(void) tcsetattr(fileno(stdin), TCSADRAIN, &termios);
23 }
24 
25 #ifdef SUSPEND		/* implies BSD */
26 #include	<signal.h>
27 dosuspend() {
28 #ifdef SIGTSTP
29 	if(signal(SIGTSTP, SIG_IGN) == SIG_DFL) {
30 		settty((char *) 0);
31 		(void) signal(SIGTSTP, SIG_DFL);
32 		(void) kill(0, SIGTSTP);
33 		gettty();
34 		setftty();
35 		docrt();
36 	} else {
37 		pline("I don't think your shell has job control.");
38 	}
39 #else SIGTSTP
40 	pline("Sorry, it seems we have no SIGTSTP here. Try ! or S.");
41 #endif SIGTSTP
42 	return(0);
43 }
44 #endif SUSPEND
45