Merge from vendor branch OPENSSL:
[games.git] / games / hack / hack.ioctl.c
CommitLineData
984263bc
MD
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 $
c7106d58 4 $DragonFly: src/games/hack/hack.ioctl.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $
984263bc 5
304d60d9 6 This cannot be part of hack.tty.c (as it was earlier) since on some
984263bc
MD
7 systems (e.g. MUNIX) the include files <termio.h> and <sgtty.h>
8 define the same constants, and the C preprocessor complains. */
c7106d58 9#include "hack.h"
984263bc
MD
10#ifdef BSD
11#include <sgtty.h>
12struct ltchars ltchars, ltchars0;
13#else
14#include <termio.h> /* also includes part of <sgtty.h> */
15struct termio termio;
304d60d9 16#endif /* BSD */
984263bc 17
c7106d58
PA
18void
19getioctls(void)
20{
984263bc 21#ifdef BSD
c7106d58
PA
22 ioctl(fileno(stdin), (int) TIOCGLTC, (char *) &ltchars);
23 ioctl(fileno(stdin), (int) TIOCSLTC, (char *) &ltchars0);
984263bc 24#else
c7106d58 25 ioctl(fileno(stdin), (int) TCGETA, &termio);
304d60d9 26#endif /* BSD */
984263bc
MD
27}
28
c7106d58
PA
29void
30setioctls(void)
31{
984263bc 32#ifdef BSD
c7106d58 33 ioctl(fileno(stdin), (int) TIOCSLTC, (char *) &ltchars);
984263bc 34#else
c7106d58 35 ioctl(fileno(stdin), (int) TCSETA, &termio);
304d60d9 36#endif /* BSD */
984263bc
MD
37}
38
39#ifdef SUSPEND /* implies BSD */
40#include <signal.h>
c7106d58
PA
41int
42dosuspend(void)
43{
984263bc
MD
44#ifdef SIGTSTP
45 if(signal(SIGTSTP, SIG_IGN) == SIG_DFL) {
46 settty((char *) 0);
c7106d58
PA
47 signal(SIGTSTP, SIG_DFL);
48 kill(0, SIGTSTP);
984263bc
MD
49 gettty();
50 setftty();
51 docrt();
52 } else {
53 pline("I don't think your shell has job control.");
54 }
304d60d9 55#else /* SIGTSTP */
984263bc 56 pline("Sorry, it seems we have no SIGTSTP here. Try ! or S.");
304d60d9 57#endif /* SIGTSTP */
984263bc
MD
58 return(0);
59}
304d60d9 60#endif /* SUSPEND */