Commit | Line | Data |
---|---|---|
b120c7bb KB |
1 | /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ |
2 | /* hack.ioctl.c - version 1.0.2 */ | |
3 | ||
4 | /* This cannot be part of hack.tty.c (as it was earlier) since on some | |
5 | systems (e.g. MUNIX) the include files <termio.h> and <sgtty.h> | |
6 | define the same constants, and the C preprocessor complains. */ | |
7 | #include <stdio.h> | |
8 | #include "config.h" | |
9 | #ifdef BSD | |
10 | #include <sgtty.h> | |
11 | struct ltchars ltchars, ltchars0; | |
12 | #else | |
13 | #include <termio.h> /* also includes part of <sgtty.h> */ | |
14 | struct termio termio; | |
15 | #endif BSD | |
16 | ||
17 | getioctls() { | |
18 | #ifdef BSD | |
19 | (void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) <chars); | |
20 | (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars0); | |
21 | #else | |
22 | (void) ioctl(fileno(stdin), (int) TCGETA, &termio); | |
23 | #endif BSD | |
24 | } | |
25 | ||
26 | setioctls() { | |
27 | #ifdef BSD | |
28 | (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars); | |
29 | #else | |
30 | (void) ioctl(fileno(stdin), (int) TCSETA, &termio); | |
31 | #endif BSD | |
32 | } | |
33 | ||
34 | #ifdef SUSPEND /* implies BSD */ | |
35 | dosuspend() { | |
36 | #include <signal.h> | |
37 | #ifdef SIGTSTP | |
38 | if(signal(SIGTSTP, SIG_IGN) == SIG_DFL) { | |
39 | settty((char *) 0); | |
40 | (void) signal(SIGTSTP, SIG_DFL); | |
41 | (void) kill(0, SIGTSTP); | |
42 | gettty(); | |
43 | setftty(); | |
44 | docrt(); | |
45 | } else { | |
46 | pline("I don't think your shell has job control."); | |
47 | } | |
48 | #else SIGTSTP | |
49 | pline("Sorry, it seems we have no SIGTSTP here. Try ! or S."); | |
50 | #endif SIGTSTP | |
51 | return(0); | |
52 | } | |
53 | #endif SUSPEND |