Mercurial > hg > early-roguelike
comparison srogue/newterm.c @ 36:2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
author | elwin |
---|---|
date | Thu, 25 Nov 2010 12:21:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
35:05018c63a721 | 36:2128c7dc8a40 |
---|---|
1 /* | |
2 * Super-Rogue | |
3 * Copyright (C) 1984 Robert D. Kindelberger | |
4 * All rights reserved. | |
5 * | |
6 * See the file LICENSE.TXT for full copyright and licensing information. | |
7 */ | |
8 | |
9 #include "rogue.h" | |
10 | |
11 extern SGTTY _tty, _res_flg; | |
12 extern bool NONL; | |
13 | |
14 raw() | |
15 { | |
16 /* | |
17 VERSION 5.0 | |
18 _tty.c_lflag &= ~ICANON; | |
19 _tty.c_cc[VMIN] = 1; | |
20 _tty.c_cc[VTIME] = 255; | |
21 _tty.c_oflag &= ~OPOST; | |
22 */ | |
23 _rawmode = TRUE; | |
24 _tty.sg_flags |= CBREAK; | |
25 ioctl(_tty_ch, TIOCSETP, &_tty); | |
26 } | |
27 | |
28 | |
29 noraw() | |
30 { | |
31 /* | |
32 VERSION 5.0 | |
33 _tty.c_lflag |= ICANON; | |
34 _tty.c_cc[VMIN] = _res_flg.c_cc[VMIN]; | |
35 _tty.c_cc[VTIME] = _res_flg.c_cc[VTIME]; | |
36 _tty.c_oflag |= OPOST; | |
37 */ | |
38 _rawmode = FALSE; | |
39 _tty.sg_flags &= ~CBREAK; | |
40 ioctl(_tty_ch, TIOCSETP, &_tty); | |
41 } | |
42 | |
43 | |
44 crmode() | |
45 { | |
46 /* | |
47 VERSION 5.0 | |
48 _tty.c_lflag &= ~ICANON; | |
49 _tty.c_oflag |= ONLCR; | |
50 _tty.c_cc[VMIN] = 1; | |
51 _tty.c_cc[VTIME]=255; | |
52 */ | |
53 _rawmode = TRUE; | |
54 _tty.sg_flags |= (CBREAK | CRMOD); | |
55 ioctl(_tty_ch, TIOCSETP, &_tty); | |
56 } | |
57 | |
58 | |
59 nocrmode() | |
60 { | |
61 /* | |
62 _tty.c_lflag |= ICANON; | |
63 _tty.c_cc[VMIN]=_res_flg.c_cc[VMIN]; | |
64 _tty.c_cc[VTIME]=_res_flg.c_cc[VTIME]; | |
65 */ | |
66 _rawmode = FALSE; | |
67 _tty.sg_flags &= ~CBREAK; | |
68 ioctl(_tty_ch, TIOCSETP, &_tty); | |
69 } | |
70 | |
71 | |
72 echo() | |
73 { | |
74 _tty.sg_flags |= ECHO; | |
75 _echoit=TRUE; | |
76 ioctl(_tty_ch, TIOCSETP, &_tty); | |
77 } | |
78 | |
79 noecho() | |
80 { | |
81 _tty.sg_flags &= ~ECHO; | |
82 _echoit = FALSE; | |
83 ioctl(_tty_ch, TIOCSETP, &_tty); | |
84 } | |
85 | |
86 | |
87 nl() | |
88 { | |
89 /* | |
90 VERSION 5.0 | |
91 _tty.c_iflag |= ICRNL; | |
92 _tty.c_oflag |= ONLCR; | |
93 */ | |
94 _tty.sg_flags |= CRMOD; | |
95 NONL = TRUE; | |
96 ioctl(_tty_ch, TIOCSETP, &_tty); | |
97 } | |
98 | |
99 | |
100 nonl() | |
101 { | |
102 /* | |
103 VERSION 5.0 | |
104 _tty.c_iflag &= ~ICRNL; | |
105 _tty.c_oflag &= ~ONLCR; | |
106 */ | |
107 _tty.sg_flags &= ~CRMOD; | |
108 NONL = FALSE; | |
109 ioctl(_tty_ch, TIOCSETP, &_tty); | |
110 } | |
111 | |
112 savetty() | |
113 { | |
114 ioctl(_tty_ch, TIOCGETP, &_tty); | |
115 _res_flg = _tty; | |
116 } | |
117 | |
118 resetty() | |
119 { | |
120 _tty = _res_flg; | |
121 ioctl(_tty_ch, TIOCSETP, &_tty); | |
122 } |