NetBSD/games/hack/hack.ioctl.c

56 lines
1.2 KiB
C
Raw Normal View History

1997-10-19 20:56:41 +04:00
/* $NetBSD: hack.ioctl.c,v 1.6 1997/10/19 16:58:07 christos Exp $ */
1993-08-02 21:16:36 +04:00
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*/
1997-10-19 20:56:41 +04:00
#include <sys/cdefs.h>
1993-08-02 21:16:36 +04:00
#ifndef lint
1997-10-19 20:56:41 +04:00
__RCSID("$NetBSD: hack.ioctl.c,v 1.6 1997/10/19 16:58:07 christos Exp $");
#endif /* not lint */
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
/*
* This cannot be part of hack.tty.c (as it was earlier) since on some
* systems (e.g. MUNIX) the include files <termio.h> and <sgtty.h> define the
* same constants, and the C preprocessor complains.
*/
1995-04-29 03:01:45 +04:00
#include <termios.h>
1997-10-19 20:56:41 +04:00
#include "hack.h"
#include "extern.h"
struct termios termios;
1993-03-21 12:45:37 +03:00
1997-10-19 20:56:41 +04:00
void
getioctls()
{
1995-04-29 03:01:45 +04:00
(void) tcgetattr(fileno(stdin), &termios);
1993-03-21 12:45:37 +03:00
}
1997-10-19 20:56:41 +04:00
void
setioctls()
{
1995-04-29 03:01:45 +04:00
(void) tcsetattr(fileno(stdin), TCSADRAIN, &termios);
1993-03-21 12:45:37 +03:00
}
1997-10-19 20:56:41 +04:00
#ifdef SUSPEND /* implies BSD */
1993-03-21 12:45:37 +03:00
#include <signal.h>
1997-10-19 20:56:41 +04:00
int
dosuspend()
{
1993-03-21 12:45:37 +03:00
#ifdef SIGTSTP
1997-10-19 20:56:41 +04:00
if (signal(SIGTSTP, SIG_IGN) == SIG_DFL) {
1993-03-21 12:45:37 +03:00
settty((char *) 0);
(void) signal(SIGTSTP, SIG_DFL);
(void) kill(0, SIGTSTP);
gettty();
setftty();
docrt();
} else {
pline("I don't think your shell has job control.");
}
1997-10-19 20:56:41 +04:00
#else /* SIGTSTP */
1993-03-21 12:45:37 +03:00
pline("Sorry, it seems we have no SIGTSTP here. Try ! or S.");
1997-10-19 20:56:41 +04:00
#endif /* SIGTSTP */
return (0);
1993-03-21 12:45:37 +03:00
}
1997-10-19 20:56:41 +04:00
#endif /* SUSPEND */