-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhack.ioctl.c
56 lines (49 loc) · 1.37 KB
/
hack.ioctl.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* hack.ioctl.c - version 1.0.2 */
/* 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. */
#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 termios termio;
#endif /* BSD */
void getioctls(void) {
#ifdef BSD
(void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) <chars);
(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars0);
#else
(void) ioctl(fileno(stdin), (int) TCGETS, &termio);
#endif /* BSD */
}
void setioctls(void) {
#ifdef BSD
(void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars);
#else
(void) ioctl(fileno(stdin), (int) TCSETS, &termio);
#endif /* BSD */
}
#ifdef SUSPEND /* implies BSD */
int dosuspend(void) {
#include <signal.h>
#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.");
}
#else /* SIGTSTP */
pline("Sorry, it seems we have no SIGTSTP here. Try ! or S.");
#endif /* SIGTSTP */
return(0);
}
#endif /* SUSPEND */