1994-09-04 04:03:31 +00:00
|
|
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
|
|
|
/* hack.ioctl.c - version 1.0.2 */
|
2002-04-12 20:16:15 +00:00
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
1994-09-04 04:03:31 +00: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. */
|
2002-04-12 20:16:15 +00:00
|
|
|
|
1994-09-04 04:03:31 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "config.h"
|
|
|
|
#ifdef BSD
|
|
|
|
#include <sgtty.h>
|
|
|
|
struct ltchars ltchars, ltchars0;
|
|
|
|
#else
|
|
|
|
#include <termio.h> /* also includes part of <sgtty.h> */
|
|
|
|
struct termio termio;
|
2002-05-23 00:38:07 +00:00
|
|
|
#endif /* BSD */
|
1994-09-04 04:03:31 +00:00
|
|
|
|
|
|
|
getioctls() {
|
|
|
|
#ifdef BSD
|
|
|
|
(void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) <chars);
|
|
|
|
(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars0);
|
|
|
|
#else
|
|
|
|
(void) ioctl(fileno(stdin), (int) TCGETA, &termio);
|
2002-05-23 00:38:07 +00:00
|
|
|
#endif /* BSD */
|
1994-09-04 04:03:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
setioctls() {
|
|
|
|
#ifdef BSD
|
|
|
|
(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars);
|
|
|
|
#else
|
|
|
|
(void) ioctl(fileno(stdin), (int) TCSETA, &termio);
|
2002-05-23 00:38:07 +00:00
|
|
|
#endif /* BSD */
|
1994-09-04 04:03:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef SUSPEND /* implies BSD */
|
|
|
|
#include <signal.h>
|
1999-09-12 07:01:23 +00:00
|
|
|
dosuspend() {
|
1994-09-04 04:03:31 +00:00
|
|
|
#ifdef SIGTSTP
|
|
|
|
if(signal(SIGTSTP, SIG_IGN) == SIG_DFL) {
|
|
|
|
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.");
|
|
|
|
}
|
2002-05-23 00:38:07 +00:00
|
|
|
#else /* SIGTSTP */
|
1994-09-04 04:03:31 +00:00
|
|
|
pline("Sorry, it seems we have no SIGTSTP here. Try ! or S.");
|
2002-05-23 00:38:07 +00:00
|
|
|
#endif /* SIGTSTP */
|
1994-09-04 04:03:31 +00:00
|
|
|
return(0);
|
|
|
|
}
|
2002-05-23 00:38:07 +00:00
|
|
|
#endif /* SUSPEND */
|