games: Massive style(9) cleanup commit. Reduces differences to NetBSD.
[dragonfly.git] / games / hack / hack.ioctl.c
blob980755a8061823c8ee07e7884cbbce3d415034f4
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 $
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> define the
8 * same constants, and the C preprocessor complains.
9 */
10 #include "hack.h"
11 #include <termios.h>
12 struct termios termio;
14 void
15 getioctls(void)
17 tcgetattr(fileno(stdin), &termio);
20 void
21 setioctls(void)
23 tcsetattr(fileno(stdin), TCSANOW, &termio);
26 #ifdef SUSPEND
27 #include <signal.h>
28 int
29 dosuspend(void)
31 #ifdef SIGTSTP
32 if (signal(SIGTSTP, SIG_IGN) == SIG_DFL) {
33 settty(NULL);
34 signal(SIGTSTP, SIG_DFL);
35 kill(0, SIGTSTP);
36 gettty();
37 setftty();
38 docrt();
39 } else {
40 pline("I don't think your shell has job control.");
42 #else /* SIGTSTP */
43 pline("Sorry, it seems we have no SIGTSTP here. Try ! or S.");
44 #endif /* SIGTSTP */
45 return (0);
47 #endif /* SUSPEND */